package com.sg.service.biz.framework.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.sg.common.util.CommonFunctionHelper;
import com.sg.common.util.RedisUtil;
import com.sg.dto.base.framework.req.*;
import com.sg.dto.biz.framework.req.*;
import com.sg.dto.biz.framework.res.*;
import com.sg.dto.integration.component.QueryItemMatchResultToAnswerDetailComReqDto;
import com.sg.dto.integration.component.QueryItemMatchResultToAnswerDetailComRespDto;
import com.sg.service.base.framework.*;
import com.sg.service.biz.framework.OrgService;
import com.wicket.okrcomponent.integration.ConfSchemeService;
import com.sg.common.exception.Assert;
import com.wicket.okrframework.common.exception.BizException;
import com.wicket.okrframework.dal.po.mbg.*;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class BusinessObjectServiceImpl
        implements com.wicket.okrframework.biz.service.BusinessObjectService {

    @Resource
    private RedisUtil redisUtil;
    @Resource
    private MUsersService mUsersService;
    @Resource
    private MUserinfoService mUserinfoService;
    @Resource
    private MOriginalRoleMemberService mOriginalRoleMemberService;
    @Resource
    private MOriginalRoleMemberInfoService mOriginalRoleMemberInfoService;
    @Resource
    private MRoleMemberService mRoleMemberService;
    @Resource
    private MSceneRoleService mSceneRoleService;
    @Resource
    private MInductionRecordService mInductionRecordService;
    @Resource
    private MPlatformAuthorizeService mPlatformAuthorizeService;
    @Resource
    private MPrivacyService mPrivacyService;
    // @Resource
    // private MSpecMethordTableService mSpecMethordTableService;
    @Resource
    private MPrivacyDistributionService mPrivacyDistributionService;
    @Resource
    private MDeptService mDeptService;
    @Resource
    private MMetadataBusinessObjectService mMetadataBusinessObjectService;
    @Resource
    private MMetadataPropertyTypeService mMetadataPropertyTypeService;
    @Resource
    private MMetadataTypeService mMetadataTypeService;
    @Resource
    private MMetadataObjectPropertyService mMetadataObjectPropertyService;
    @Resource
    private NbBusinessObject nbBusinessObject;
    @Resource
    private MBizSceneService mBizSceneService;
    @Resource
    private MBizAppSceneService mBizAppSceneService;
    @Resource
    private MPositionService mPositionService;
    @Resource
    private MOrganizationService mOrganizationService;
    @Resource
    private MStaffingService mStaffingService;
    @Resource
    private ConfSchemeService confSchemeService;
    @Resource
    private OrgService orgService;
    @Resource
    private MTagService mTagService;

    /**
     * D1-查询用户登录信息[1194]
     * gen by moon at 10/2/2022, 12:01:16 AM
     */
    @Trace(operationName = "D1-查询用户登录信息")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryUserLoginInfoRespDto queryUserLoginInfo(QueryUserLoginInfoReqDto reqDto) {


        Users users_1 = null;
        Userinfo userinfo_1 = null;
        OriginalRoleMember originalRoleMember_1 = null;
        OriginalRoleMemberInfo originalRoleMemberInfo_1 = null;
        List<SceneRole> listSceneRole_1 = new ArrayList<>();
        List<InductionRecord> listInductionRecord_1 = new ArrayList<>();
        List<Dept> listDept_1 = new ArrayList<>();
//virtualUsage 1-2-01查询个人账号详情  1109
        Users users = null;
        QueryUserDetailReq queryUserDetailReq = new QueryUserDetailReq();
        if (reqDto != null) {
            queryUserDetailReq.setUserId(reqDto.getUserId());//SimpleFieldAssign//sourceId:43210_1_1109
        }

        /*1-2-01查询个人账号详情[286]   */

        users = mUsersService.queryUserDetail(queryUserDetailReq);


        users_1 = users;
//virtualUsage 1-2-02查询个人资料详情  1110
        Userinfo userinfo = null;
        QueryUserinfoDetailReq queryUserinfoDetailReq = new QueryUserinfoDetailReq();
        if (reqDto != null) {
            queryUserinfoDetailReq.setUserId(reqDto.getUserId());//SimpleFieldAssign//sourceId:27486_1_1110
        }

        /*1-2-02查询个人资料详情[155]   */
        Assert.isNull(queryUserinfoDetailReq.getUserId(), "D1-查询用户登录信息-1-2-02查询个人资料详情-账号不能为空", false);
        userinfo = mUserinfoService.queryUserinfoDetail(queryUserinfoDetailReq);


        userinfo_1 = userinfo;
//virtualUsage 1-2-09查询身份人员详情  1111
        OriginalRoleMember originalRoleMember = null;
        QueryBeginMemberDetailReq queryBeginMemberDetailReq = new QueryBeginMemberDetailReq();
        queryBeginMemberDetailReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:34412_1_1111
        queryBeginMemberDetailReq.setIsArchive("FALSE");//sourceId:34423_1_1111
        if (reqDto != null) {
            queryBeginMemberDetailReq.setUserId(reqDto.getUserId());//SimpleFieldAssign//sourceId:34421_1_1111
            queryBeginMemberDetailReq.setRoleCode(reqDto.getRoleCode());//SimpleFieldAssign//sourceId:34422_1_1111
            queryBeginMemberDetailReq.setSpaceId(reqDto.getSpaceId());//SimpleFieldAssign//sourceId:152651_1_1111
        }

        /*1-2-09查询身份人员详情[174]   */
        Assert.isNull(queryBeginMemberDetailReq.getRoleCode(), "D1-查询用户登录信息-1-2-09查询身份人员详情-身份角色编码不能为空", false);
        Assert.isNull(queryBeginMemberDetailReq.getSubjectLifeCycle(), "D1-查询用户登录信息-1-2-09查询身份人员详情-主体生命周期不能为空", false);
        Assert.isNull(queryBeginMemberDetailReq.getIsArchive(), "D1-查询用户登录信息-1-2-09查询身份人员详情-是否存档不能为空", false);
        originalRoleMember = mOriginalRoleMemberService.queryBeginMemberDetail(queryBeginMemberDetailReq);


        originalRoleMember_1 = originalRoleMember;
//virtualUsage 1-2-10查询身份人员资料详情  1112
        OriginalRoleMemberInfo originalRoleMemberInfo = null;
        if (originalRoleMember != null) {
            QueryBeginMembInfoDetailReq queryBeginMembInfoDetailReq = new QueryBeginMembInfoDetailReq();
            if (originalRoleMember != null) {
                queryBeginMembInfoDetailReq.setOriginalRoleMemberId(originalRoleMember.getOriginalRoleMemberId());//SimpleFieldAssign//sourceId:27506_1_1112
            }
            if (reqDto != null) {
                queryBeginMembInfoDetailReq.setSpaceId(reqDto.getSpaceId());//SimpleFieldAssign//sourceId:27507_1_1112
                queryBeginMembInfoDetailReq.setAppId(reqDto.getAppId());//SimpleFieldAssign//sourceId:27508_1_1112
            }

            /*1-2-10查询身份人员资料详情[116]   */

            originalRoleMemberInfo = mOriginalRoleMemberInfoService.queryBeginMembInfoDetail(queryBeginMembInfoDetailReq);


            originalRoleMemberInfo_1 = originalRoleMemberInfo;
        }
//virtualUsage 1-2-13查询角色人员列表  1367
        List<RoleMember> listRoleMember = new ArrayList<>();
        if (originalRoleMember != null) {
            QueryRoleRelListReq queryRoleRelListReq = new QueryRoleRelListReq();
            queryRoleRelListReq.setRelationshipValid("FALSE");//sourceId:27532_1_1367
            queryRoleRelListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:27533_1_1367
            if (originalRoleMember != null) {
                queryRoleRelListReq.setOriginalRoleMemberId(originalRoleMember.getOriginalRoleMemberId());//SimpleFieldAssign//sourceId:27531_1_1367
            }

            /*1-2-13查询角色人员列表[334]   */
            Assert.isNull(queryRoleRelListReq.getOriginalRoleMemberId(), "D1-查询用户登录信息-1-2-13查询角色人员列表-身份人员ID不能为空", false);
            Assert.isNull(queryRoleRelListReq.getRelationshipValid(), "D1-查询用户登录信息-1-2-13查询角色人员列表-是否失效不能为空", false);
            Assert.isNull(queryRoleRelListReq.getSubjectLifeCycle(), "D1-查询用户登录信息-1-2-13查询角色人员列表-主体生命周期不能为空", false);
            listRoleMember = mRoleMemberService.queryRoleRelList(queryRoleRelListReq);


        }
//virtualUsage 1-2-08批量角色ID查询角色列表  1368
        List<SceneRole> listSceneRole = new ArrayList<>();
        if (listRoleMember != null && listRoleMember.size() > 0) {
            BatchQueryByIdRoleListReq batchQueryByIdRoleListReq = new BatchQueryByIdRoleListReq();
            batchQueryByIdRoleListReq.setRoleIdList(listRoleMember.stream().map(item -> item.getRoleId())
                    .collect(Collectors.toList()));/*list-to-strings*///sourceId:27640_1_1368
            batchQueryByIdRoleListReq.setIsIdentity("FALSE");//sourceId:27644_1_1368
            batchQueryByIdRoleListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:27643_1_1368

            /*1-2-08批量角色ID查询角色列表[1166] 超级管理员，直接查询所有权限列表！  */

            listSceneRole = mSceneRoleService.batchQueryByIdRoleList(batchQueryByIdRoleListReq);


            listSceneRole_1 = listSceneRole;
        }
//virtualUsage 1-3-13查询就职记录列表  1379
        List<InductionRecord> listInductionRecord = new ArrayList<>();
        if (originalRoleMember != null) {
            QueryInductionRecordListReq queryInductionRecordListReq = new QueryInductionRecordListReq();
            queryInductionRecordListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:27705_1_1379
            if (originalRoleMember != null) {
                queryInductionRecordListReq.setOriginalRoleMemberId(originalRoleMember.getOriginalRoleMemberId());//SimpleFieldAssign//sourceId:27702_1_1379
            }
            if (reqDto != null) {
                queryInductionRecordListReq.setSpaceId(reqDto.getSpaceId());//SimpleFieldAssign//sourceId:27707_1_1379
                queryInductionRecordListReq.setAppId(reqDto.getAppId());//SimpleFieldAssign//sourceId:27708_1_1379
            }

            /*1-3-13查询就职记录列表[166] 查询就职记录列表，获取组织ID（最新就职记录对应的组织ID）  */
            Assert.isNull(queryInductionRecordListReq.getSpaceId(), "D1-查询用户登录信息-1-3-13查询就职记录列表-创建于空间ID不能为空", false);
            Assert.isNull(queryInductionRecordListReq.getAppId(), "D1-查询用户登录信息-1-3-13查询就职记录列表-创建于联盟应用ID不能为空", false);
            listInductionRecord = mInductionRecordService.queryInductionRecordList(queryInductionRecordListReq);

            listInductionRecord_1 = listInductionRecord;
        }
//virtualUsage 1-2-13查询角色人员详情（查空间管理员角色）  1381
        RoleMember roleMember = null;
        if (originalRoleMember != null) {
            QueryRoleRelDetailReq queryRoleRelDetailReq = new QueryRoleRelDetailReq();
            queryRoleRelDetailReq.setRoleCode("ADMIN");//CUSTOM_CONVENTION//sourceId:45612_1_1381
            if (originalRoleMember != null) {
                queryRoleRelDetailReq.setOriginalRoleMemberId(originalRoleMember.getOriginalRoleMemberId());//SimpleFieldAssign//sourceId:45594_1_1381
            }

            /*1-2-13查询角色人员详情（查空间管理员角色）[335]   */

            roleMember = mRoleMemberService.queryRoleRelDetail(queryRoleRelDetailReq);


        }
        if ((roleMember != null)) {
            //if(1-2-13查询角色人员详情.出参 不等于空 )  1382

            List<PlatformAuthorize> listPlatformAuthorize = new ArrayList<>();
            QueryPlfAuthListReq queryPlfAuthListReq = new QueryPlfAuthListReq();
            queryPlfAuthListReq.setTypeCode("AUTH");//sourceId:44311_1_1383
            queryPlfAuthListReq.setAuthorizeTypeCode("SENCE");//sourceId:44305_1_1383
            queryPlfAuthListReq.setAuthorizedObject(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSceneId());//CURRENT_SCENEID//sourceId:44306_1_1383
            queryPlfAuthListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:44307_1_1383

            /*1-1-06查询平台授权范围列表[1355]   */

            listPlatformAuthorize = mPlatformAuthorizeService.queryPlfAuthList(queryPlfAuthListReq);


            List<Privacy> listPrivacy = new ArrayList<>();
            if (listPlatformAuthorize != null && listPlatformAuthorize.size() > 0) {
                BatchQueryPowerListReq batchQueryPowerListReq = new BatchQueryPowerListReq();
                batchQueryPowerListReq.setPowerIdList(listPlatformAuthorize.stream().map(item -> item.getAuthorizedContentId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:44326_1_1384
                batchQueryPowerListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:44329_1_1384

                /*1-2-11批量查询权限列表[1245]   */
                Assert.isNull(batchQueryPowerListReq.getSubjectLifeCycle(), "D1-查询用户登录信息-1-2-11批量查询权限列表-主体生命周期不能为空", false);
                listPrivacy = mPrivacyService.batchQueryPowerList(batchQueryPowerListReq);


            }
//ModelCode: putUserBasicInfoToRedis
            PutUserBasicInfoToRedisRespDto putUserBasicInfoToRedisRes = null;
            if (users != null && originalRoleMember != null && userinfo != null && originalRoleMemberInfo != null) {
                PutUserBasicInfoToRedisReqDto putUserBasicInfoToRedisReq = new PutUserBasicInfoToRedisReqDto();
                putUserBasicInfoToRedisReq.setPowerCodeList(listPrivacy.stream().map(item -> BeanUtil.toBean(item, PowerCodeListDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:47299_1_1386
                putUserBasicInfoToRedisReq.setRoleList(listSceneRole.stream().map(item -> BeanUtil.toBean(item, FrameworkSceneRoleDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:47300_1_1386
                if (users != null) {
                    putUserBasicInfoToRedisReq.setUserId(users.getUserId());//SimpleFieldAssign//sourceId:47279_1_1386
                    putUserBasicInfoToRedisReq.setUserName(users.getUserName());//SimpleFieldAssign//sourceId:47287_1_1386
                    putUserBasicInfoToRedisReq.setPhone(users.getPhone());//SimpleFieldAssign//sourceId:47294_1_1386
                    putUserBasicInfoToRedisReq.setPassByPhone(users.getPassByPhone());//SimpleFieldAssign//sourceId:47295_1_1386
                    putUserBasicInfoToRedisReq.setIsUserInfoDone(users.getIsUserInfoDone());//SimpleFieldAssign//sourceId:47296_1_1386
                }
                if (originalRoleMember != null) {
                    putUserBasicInfoToRedisReq.setOriginalRoleMemberId(originalRoleMember.getOriginalRoleMemberId());//SimpleFieldAssign//sourceId:47280_1_1386
                    putUserBasicInfoToRedisReq.setMemberId(originalRoleMember.getMemberId());//SimpleFieldAssign//sourceId:47286_1_1386
                }
                if (userinfo != null) {
                    putUserBasicInfoToRedisReq.setIdCardName(userinfo.getIdCardName());//SimpleFieldAssign//sourceId:47288_1_1386
                    putUserBasicInfoToRedisReq.setNickName(userinfo.getNickName());//SimpleFieldAssign//sourceId:47289_1_1386
                    putUserBasicInfoToRedisReq.setUserFace(userinfo.getUserFace());//SimpleFieldAssign//sourceId:47290_1_1386
                    putUserBasicInfoToRedisReq.setSex(userinfo.getSex());//SimpleFieldAssign//sourceId:47291_1_1386
                    putUserBasicInfoToRedisReq.setBirthday(userinfo.getBirthday());//SimpleFieldAssign//sourceId:47292_1_1386
                    putUserBasicInfoToRedisReq.setCity(userinfo.getCity());//SimpleFieldAssign//sourceId:47293_1_1386
                }
                if (originalRoleMemberInfo != null) {
                    putUserBasicInfoToRedisReq.setRoleMemberCode(originalRoleMemberInfo.getRoleMemberCode());//SimpleFieldAssign//sourceId:47297_1_1386
                    putUserBasicInfoToRedisReq.setPositionIdName(originalRoleMemberInfo.getPositionIdName());//SimpleFieldAssign//sourceId:47298_1_1386
                }

                /*M-用户基本信息存储Redis（特殊方法）[1575]   */

                putUserBasicInfoToRedisRes = nbBusinessObject.putUserBasicInfoToRedis(putUserBasicInfoToRedisReq);


            }
//ModelCode: putUserIrInfoToRedis
            PutUserIrInfoToRedisRespDto putUserIrInfoToRedisRes = null;
            if (originalRoleMember != null && listInductionRecord != null && listInductionRecord.size() > 0) {
                PutUserIrInfoToRedisReqDto putUserIrInfoToRedisReq = new PutUserIrInfoToRedisReqDto();
                putUserIrInfoToRedisReq.setOrgInductionRecordList(listInductionRecord.stream().map(item -> BeanUtil.toBean(item, OrgInductionRecordDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:47350_1_1387
                if (originalRoleMember != null) {
                    putUserIrInfoToRedisReq.setOriginalRoleMemberId(originalRoleMember.getOriginalRoleMemberId());//SimpleFieldAssign//sourceId:59531_1_1387
                }

                /*用户就职信息存储Redis[1622]   */
                Assert.isNull(putUserIrInfoToRedisReq.getOriginalRoleMemberId(), "D1-查询用户登录信息-用户就职信息存储Redis-身份人员ID不能为空", false);
                putUserIrInfoToRedisRes = nbBusinessObject.putUserIrInfoToRedis(putUserIrInfoToRedisReq);


            }
//processBranchName:正常结束 ,processBranchId:1396

        } else {
            //else  1388

            List<PrivacyDistribution> listPrivacyDistribution = new ArrayList<>();
            if (originalRoleMember != null) {
                QueryTributPowerListReq queryTributPowerListReq = new QueryTributPowerListReq();
                queryTributPowerListReq.setTypeCode("PERSONAL");//sourceId:47346_1_1419
                queryTributPowerListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:47348_1_1419
                queryTributPowerListReq.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:258410_1_1419
                if (originalRoleMember != null) {
                    queryTributPowerListReq.setAllocationObjectId(originalRoleMember.getOriginalRoleMemberId());//SimpleFieldAssign//sourceId:47347_1_1419
                }

                /*查询身份人员权限列表[497]   */
                Assert.isNull(queryTributPowerListReq.getTypeCode(), "D1-查询用户登录信息-查询身份人员权限列表-分配对象类型编码不能为空", false);
                Assert.isNull(queryTributPowerListReq.getSubjectLifeCycle(), "D1-查询用户登录信息-查询身份人员权限列表-主体生命周期不能为空", false);
                Assert.isNull(queryTributPowerListReq.getSpaceId(), "D1-查询用户登录信息-查询身份人员权限列表-创建于空间ID不能为空", false);
                listPrivacyDistribution = mPrivacyDistributionService.queryTributPowerList(queryTributPowerListReq);


            }
            List<PrivacyDistribution> listPrivacyDistribution_2 = new ArrayList<>();
            if (listRoleMember != null && listRoleMember.size() > 0) {
                BatchQueryTributPowerListReq batchQueryTributPowerListReq = new BatchQueryTributPowerListReq();
                batchQueryTributPowerListReq.setTributPowerList(listRoleMember.stream().map(item -> item.getRoleId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:27648_1_1420
                batchQueryTributPowerListReq.setTypeCode("ROLE");//sourceId:27650_1_1420
                batchQueryTributPowerListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:44293_1_1420
                batchQueryTributPowerListReq.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:257793_1_1420

                /*查询角色权限列表[702]   */
                Assert.isNull(batchQueryTributPowerListReq.getTypeCode(), "D1-查询用户登录信息-查询角色权限列表-分配对象类型编码不能为空", false);
                Assert.isNull(batchQueryTributPowerListReq.getSubjectLifeCycle(), "D1-查询用户登录信息-查询角色权限列表-主体生命周期不能为空", false);
                Assert.isNull(batchQueryTributPowerListReq.getSpaceId(), "D1-查询用户登录信息-查询角色权限列表-创建于空间ID不能为空", false);
                listPrivacyDistribution_2 = mPrivacyDistributionService.batchQueryTributPowerList(batchQueryTributPowerListReq);


            }
            List<PrivacyDistribution> listPrivacyDistribution_4 = new ArrayList<>();
            if (listInductionRecord != null && listInductionRecord.size() > 0) {
                BatchQueryTributPowerListReq batchQueryTributPowerListReq_1 = new BatchQueryTributPowerListReq();
                batchQueryTributPowerListReq_1.setTributPowerList(listInductionRecord.stream().map(item -> item.getPositionId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:47316_1_1421
                batchQueryTributPowerListReq_1.setTypeCode("POSITION");//sourceId:47315_1_1421
                batchQueryTributPowerListReq_1.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:47318_1_1421
                batchQueryTributPowerListReq_1.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:257792_1_1421

                /*查询职务权限列表[702]   */
                Assert.isNull(batchQueryTributPowerListReq_1.getTypeCode(), "D1-查询用户登录信息-查询职务权限列表-分配对象类型编码不能为空", false);
                Assert.isNull(batchQueryTributPowerListReq_1.getSubjectLifeCycle(), "D1-查询用户登录信息-查询职务权限列表-主体生命周期不能为空", false);
                Assert.isNull(batchQueryTributPowerListReq_1.getSpaceId(), "D1-查询用户登录信息-查询职务权限列表-创建于空间ID不能为空", false);
                listPrivacyDistribution_4 = mPrivacyDistributionService.batchQueryTributPowerList(batchQueryTributPowerListReq_1);


            }
            List<PrivacyDistribution> listPrivacyDistribution_6 = new ArrayList<>();
            if (listInductionRecord != null && listInductionRecord.size() > 0) {
                BatchQueryTributPowerListReq batchQueryTributPowerListReq_2 = new BatchQueryTributPowerListReq();
                batchQueryTributPowerListReq_2.setTributPowerList(listInductionRecord.stream().map(item -> item.getDeptPositionRelationshipId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:47107_1_1422
                batchQueryTributPowerListReq_2.setTypeCode("DEPARTMENT_POSITION");//sourceId:27711_1_1422
                batchQueryTributPowerListReq_2.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:44294_1_1422
                batchQueryTributPowerListReq_2.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:258411_1_1422

                /*查询部门职务权限列表[702]   */
                Assert.isNull(batchQueryTributPowerListReq_2.getTypeCode(), "D1-查询用户登录信息-查询部门职务权限列表-分配对象类型编码不能为空", false);
                Assert.isNull(batchQueryTributPowerListReq_2.getSubjectLifeCycle(), "D1-查询用户登录信息-查询部门职务权限列表-主体生命周期不能为空", false);
                Assert.isNull(batchQueryTributPowerListReq_2.getSpaceId(), "D1-查询用户登录信息-查询部门职务权限列表-创建于空间ID不能为空", false);
                listPrivacyDistribution_6 = mPrivacyDistributionService.batchQueryTributPowerList(batchQueryTributPowerListReq_2);


            }
            List<PrivacyDistribution> listPrivacyDistribution_8 = new ArrayList<>();
            if (listInductionRecord != null && listInductionRecord.size() > 0) {
                BatchQueryTributPowerListReq batchQueryTributPowerListReq_3 = new BatchQueryTributPowerListReq();
                batchQueryTributPowerListReq_3.setTributPowerList(listInductionRecord.stream().map(item -> item.getInductionRecordId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:47106_1_1423
                batchQueryTributPowerListReq_3.setTypeCode("PERSONAL_DEPARTMENT");//sourceId:27714_1_1423
                batchQueryTributPowerListReq_3.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:44295_1_1423
                batchQueryTributPowerListReq_3.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:257796_1_1423

                /*查询就职记录权限列表[702]   */
                Assert.isNull(batchQueryTributPowerListReq_3.getTypeCode(), "D1-查询用户登录信息-查询就职记录权限列表-分配对象类型编码不能为空", false);
                Assert.isNull(batchQueryTributPowerListReq_3.getSubjectLifeCycle(), "D1-查询用户登录信息-查询就职记录权限列表-主体生命周期不能为空", false);
                Assert.isNull(batchQueryTributPowerListReq_3.getSpaceId(), "D1-查询用户登录信息-查询就职记录权限列表-创建于空间ID不能为空", false);
                listPrivacyDistribution_8 = mPrivacyDistributionService.batchQueryTributPowerList(batchQueryTributPowerListReq_3);


            }
            List<SceneRole> listSceneRole_2 = new ArrayList<>();
            if (listInductionRecord != null && listInductionRecord.size() > 0) {
                BatchQueryByCodeRoleListReq batchQueryByCodeRoleListReq = new BatchQueryByCodeRoleListReq();
                batchQueryByCodeRoleListReq.setRoleCodeList(listInductionRecord.stream().map(item -> item.getPositionRoleCode())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:50364_1_1628
                batchQueryByCodeRoleListReq.setIsFreeze("FALSE");//sourceId:50372_1_1628
                batchQueryByCodeRoleListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:50375_1_1628

                /*通过职务对应的角色编码查询角色[1167]   */

                listSceneRole_2 = mSceneRoleService.batchQueryByCodeRoleList(batchQueryByCodeRoleListReq);


            }
            List<PrivacyDistribution> listPrivacyDistribution_10 = new ArrayList<>();
            if (listSceneRole_2 != null && listSceneRole_2.size() > 0) {
                BatchQueryTributPowerListReq batchQueryTributPowerListReq_4 = new BatchQueryTributPowerListReq();
                batchQueryTributPowerListReq_4.setTributPowerList(listSceneRole_2.stream().map(item -> item.getRoleId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:50398_1_1629
                batchQueryTributPowerListReq_4.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:50400_1_1629
                batchQueryTributPowerListReq_4.setTypeCode("ROLE");//sourceId:50397_1_1629
                batchQueryTributPowerListReq_4.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:257797_1_1629

                /*查询职务角色编码对应的权限[702]   */
                Assert.isNull(batchQueryTributPowerListReq_4.getSubjectLifeCycle(), "D1-查询用户登录信息-查询职务角色编码对应的权限-主体生命周期不能为空", false);
                Assert.isNull(batchQueryTributPowerListReq_4.getTypeCode(), "D1-查询用户登录信息-查询职务角色编码对应的权限-分配对象类型编码不能为空", false);
                Assert.isNull(batchQueryTributPowerListReq_4.getSpaceId(), "D1-查询用户登录信息-查询职务角色编码对应的权限-创建于空间ID不能为空", false);
                listPrivacyDistribution_10 = mPrivacyDistributionService.batchQueryTributPowerList(batchQueryTributPowerListReq_4);


            }
//ModelCode: collectionsAggregation
            CollectionsAggregationRespDto collectionsAggregationRes = null;
            if (listSceneRole_2 != null && listSceneRole_2.size() > 0) {
                CollectionsAggregationReqDto collectionsAggregationReq = new CollectionsAggregationReqDto();
                collectionsAggregationReq.setRoleList(listSceneRole_2.stream().map(item -> {
                    FrameworkSceneRoleDto elm = BeanUtil.toBean(item, FrameworkSceneRoleDto.class);
                    //elm.setRoleId();//AGGREGATION_ID  TODO ruizhe dong

                    return elm;
                }).collect(Collectors.toList()));//objList-to-objLists//sourceId:51035_1_1696
                collectionsAggregationReq.setTributPowerList(listPrivacyDistribution_10.stream().map(item -> {
                    TributPowerDto elm = BeanUtil.toBean(item, TributPowerDto.class);
                    //elm.setAllocationObjectId();//AGGREGATION_ID  TODO ruizhe dong

                    return elm;
                }).collect(Collectors.toList()));//objList-to-objLists//sourceId:51036_1_1696

                /*M-数据集聚合（特殊方法）[1704]  入参多个数据集，按照聚合标识得到一个新的数据集 */

                collectionsAggregationRes = nbBusinessObject.collectionsAggregation(collectionsAggregationReq);


            }
//ModelCode: putUserBasicInfoToRedis
            PutUserBasicInfoToRedisRespDto putUserBasicInfoToRedisRes_1 = null;
            if (users != null && originalRoleMember != null && userinfo != null && originalRoleMemberInfo != null && listPrivacyDistribution != null && listPrivacyDistribution.size() > 0) {
                PutUserBasicInfoToRedisReqDto putUserBasicInfoToRedisReq_1 = new PutUserBasicInfoToRedisReqDto();
                putUserBasicInfoToRedisReq_1.setPowerCodeList(listPrivacyDistribution.stream().map(item -> BeanUtil.toBean(item, PowerCodeListDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:47299_1_1425
                putUserBasicInfoToRedisReq_1.setRoleList(listSceneRole.stream().map(item -> BeanUtil.toBean(item, FrameworkSceneRoleDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:47300_1_1425
                putUserBasicInfoToRedisReq_1.setFrameworkPrivacyList(//objList-to-objLists
                        listPrivacyDistribution_2.stream().map(item -> {
                            FrameworkPrivacyDto elm = new FrameworkPrivacyDto();
                            elm.setAllocationObjectId(item.getAllocationObjectId());//SimpleFieldAssign//sourceId:23259_2_1425
                            elm.setPrivacyCode(item.getPrivacyCode());//SimpleFieldAssign//sourceId:23260_2_1425
                            elm.setIsportPrivacy(item.getIsportPrivacy());//SimpleFieldAssign//sourceId:36262_2_1425
                            elm.setPrivacyRoute(item.getPrivacyRoute());//SimpleFieldAssign//sourceId:36263_2_1425
                            elm.setIsDataPrivacy(item.getPrivacyRoute());//SimpleFieldAssign//sourceId:36264_2_1425
                            elm.setDataModel(item.getDataModel());//SimpleFieldAssign//sourceId:36265_2_1425
                            elm.setPrivacyCategory(item.getPrivacyCategory());//SimpleFieldAssign//sourceId:36266_2_1425
                            elm.setBusinessPurposes(item.getBusinessPurposes());//SimpleFieldAssign//sourceId:36267_2_1425
                            return elm;
                        }).collect(Collectors.toList()));//objList-to-objLists//sourceId:47349_1_1425
                if (users != null) {
                    putUserBasicInfoToRedisReq_1.setUserId(users.getUserId());//SimpleFieldAssign//sourceId:47279_1_1425
                    putUserBasicInfoToRedisReq_1.setUserName(users.getUserName());//SimpleFieldAssign//sourceId:47287_1_1425
                    putUserBasicInfoToRedisReq_1.setPhone(users.getPhone());//SimpleFieldAssign//sourceId:47294_1_1425
                    putUserBasicInfoToRedisReq_1.setPassByPhone(users.getPassByPhone());//SimpleFieldAssign//sourceId:47295_1_1425
                    putUserBasicInfoToRedisReq_1.setIsUserInfoDone(users.getIsUserInfoDone());//SimpleFieldAssign//sourceId:47296_1_1425
                }
                if (originalRoleMember != null) {
                    putUserBasicInfoToRedisReq_1.setOriginalRoleMemberId(originalRoleMember.getOriginalRoleMemberId());//SimpleFieldAssign//sourceId:47280_1_1425
                    putUserBasicInfoToRedisReq_1.setMemberId(originalRoleMember.getMemberId());//SimpleFieldAssign//sourceId:47286_1_1425
                }
                if (userinfo != null) {
                    putUserBasicInfoToRedisReq_1.setIdCardName(userinfo.getIdCardName());//SimpleFieldAssign//sourceId:47288_1_1425
                    putUserBasicInfoToRedisReq_1.setNickName(userinfo.getNickName());//SimpleFieldAssign//sourceId:47289_1_1425
                    putUserBasicInfoToRedisReq_1.setUserFace(userinfo.getUserFace());//SimpleFieldAssign//sourceId:47290_1_1425
                    putUserBasicInfoToRedisReq_1.setSex(userinfo.getSex());//SimpleFieldAssign//sourceId:47291_1_1425
                    putUserBasicInfoToRedisReq_1.setBirthday(userinfo.getBirthday());//SimpleFieldAssign//sourceId:47292_1_1425
                    putUserBasicInfoToRedisReq_1.setCity(userinfo.getCity());//SimpleFieldAssign//sourceId:47293_1_1425
                }
                if (originalRoleMemberInfo != null) {
                    putUserBasicInfoToRedisReq_1.setRoleMemberCode(originalRoleMemberInfo.getRoleMemberCode());//SimpleFieldAssign//sourceId:47297_1_1425
                    putUserBasicInfoToRedisReq_1.setPositionIdName(originalRoleMemberInfo.getPositionIdName());//SimpleFieldAssign//sourceId:47298_1_1425
                }

                /*M-用户基本信息存储Redis（特殊方法）[1575]   */

                putUserBasicInfoToRedisRes_1 = nbBusinessObject.putUserBasicInfoToRedis(putUserBasicInfoToRedisReq_1);


            }
            List<Dept> listDept = new ArrayList<>();
            if (listInductionRecord != null && listInductionRecord.size() > 0) {
                BatchQueryDeptListReq batchQueryDeptListReq = new BatchQueryDeptListReq();
                batchQueryDeptListReq.setDeptList(listInductionRecord.stream().map(item -> item.getEntityId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:64125_1_2549

                /*1-3-09批量查询部门列表[1153]   */

                listDept = mDeptService.batchQueryDeptList(batchQueryDeptListReq);


                listDept_1 = listDept;
            }
//ModelCode: putUserIrInfoToRedis
            PutUserIrInfoToRedisRespDto putUserIrInfoToRedisRes_1 = null;
            if (originalRoleMember != null && listInductionRecord != null && listInductionRecord.size() > 0 && listDept != null && listDept.size() > 0) {
                PutUserIrInfoToRedisReqDto putUserIrInfoToRedisReq_1 = new PutUserIrInfoToRedisReqDto();
                putUserIrInfoToRedisReq_1.setOrgInductionRecordList(listInductionRecord.stream().map(item -> BeanUtil.toBean(item, OrgInductionRecordDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:47350_1_1426
                putUserIrInfoToRedisReq_1.setTributPowerDeptPositionList(listPrivacyDistribution_6.stream().map(item -> BeanUtil.toBean(item, TributPowerDepTributPowerDeptPositionListtPositionDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:47356_1_1426
                putUserIrInfoToRedisReq_1.setTributPowerPositiontList(listPrivacyDistribution_4.stream().map(item -> BeanUtil.toBean(item, TributPowerPositiontListDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:47357_1_1426
                putUserIrInfoToRedisReq_1.setTributPowerInductionRecordList(listPrivacyDistribution_8.stream().map(item -> BeanUtil.toBean(item, TributPowerInductionRecordListDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:47358_1_1426
                putUserIrInfoToRedisReq_1.setDeptList(listDept.stream().map(item -> BeanUtil.toBean(item, DeptDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:64150_1_1426
                if (originalRoleMember != null) {
                    putUserIrInfoToRedisReq_1.setOriginalRoleMemberId(originalRoleMember.getOriginalRoleMemberId());//SimpleFieldAssign//sourceId:59531_1_1426
                }
                if (collectionsAggregationRes != null) {
                    putUserIrInfoToRedisReq_1.setTributPowerRoleList(collectionsAggregationRes.getTributPowerList().stream().map(item -> BeanUtil.toBean(item, TributPowerRoleListDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:50417_1_1426
                }

                /*用户就职信息存储Redis[1622]   */
                Assert.isNull(putUserIrInfoToRedisReq_1.getOriginalRoleMemberId(), "D1-查询用户登录信息-用户就职信息存储Redis-身份人员ID不能为空", false);
                putUserIrInfoToRedisRes_1 = nbBusinessObject.putUserIrInfoToRedis(putUserIrInfoToRedisReq_1);


            }
//processBranchName:正常结束 ,processBranchId:1427

        }
        QueryUserLoginInfoRespDto retData = new QueryUserLoginInfoRespDto();
        retData.setRoleList(listSceneRole_1.stream().map(item -> BeanUtil.toBean(item, FrameworkSceneRoleDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:50256_1
//数据集融合  MoreListToOneSource
        if (listInductionRecord_1 != null && !CollectionUtil.isEmpty(listInductionRecord_1)) {
            for (InductionRecord inductionRecord : listInductionRecord_1) {
                OrgInductionRecordDto retElm = new OrgInductionRecordDto();
                retElm.setInductionRecordId(inductionRecord.getInductionRecordId());//SimpleFieldAssign//sourceId:25553_2
                retElm.setInductionUnitTypeCode(inductionRecord.getInductionUnitTypeCode());//SimpleFieldAssign//sourceId:25554_2
                retElm.setEntityId(inductionRecord.getEntityId());//SimpleFieldAssign//sourceId:25555_2
                retElm.setOrganizationId(inductionRecord.getOrganizationId());//SimpleFieldAssign//sourceId:25556_2
                retElm.setOrganizationName(inductionRecord.getOrganizationName());//SimpleFieldAssign//sourceId:25557_2
                retElm.setDeptShortName(inductionRecord.getDeptShortName());//SimpleFieldAssign//sourceId:25558_2
                retElm.setIsMainInduction(inductionRecord.getIsMainInduction());//SimpleFieldAssign//sourceId:25559_2
                retElm.setPositionType(inductionRecord.getPositionType());//SimpleFieldAssign//sourceId:25560_2
                retElm.setStaffingId(inductionRecord.getStaffingId());//SimpleFieldAssign//sourceId:25561_2
                retElm.setPositionIdNameId(inductionRecord.getPositionIdNameId());//SimpleFieldAssign//sourceId:25562_2
                retElm.setPositionIdName(inductionRecord.getPositionIdName());//SimpleFieldAssign//sourceId:25563_2
                retElm.setPositionOrderNumber(inductionRecord.getPositionOrderNumber());//SimpleFieldAssign//sourceId:25564_2
                retElm.setPositionId(inductionRecord.getPositionId());//SimpleFieldAssign//sourceId:25565_2
                retElm.setDeptPositionRelationshipId(inductionRecord.getDeptPositionRelationshipId());//SimpleFieldAssign//sourceId:25566_2
                retElm.setPositionGradeId(inductionRecord.getPositionGradeId());//SimpleFieldAssign//sourceId:25567_2
                retElm.setPositionGradeName(inductionRecord.getPositionGradeName());//SimpleFieldAssign//sourceId:25569_2
                retElm.setTypeDictionaryId(inductionRecord.getTypeDictionaryId());//SimpleFieldAssign//sourceId:25570_2
                retElm.setTypeDictionaryName(inductionRecord.getTypeDictionaryName());//SimpleFieldAssign//sourceId:25571_2
                retElm.setStationId(inductionRecord.getStationId());//SimpleFieldAssign//sourceId:25572_2
                retElm.setPostId(inductionRecord.getPostId());//SimpleFieldAssign//sourceId:25573_2
                retElm.setStationName(inductionRecord.getStationName());//SimpleFieldAssign//sourceId:25574_2
                retElm.setPostName(inductionRecord.getPostName());//SimpleFieldAssign//sourceId:25575_2
                retElm.setStationTypeId(inductionRecord.getStationTypeId());//SimpleFieldAssign//sourceId:25576_2
                retElm.setStationTypeName(inductionRecord.getStationTypeName());//SimpleFieldAssign//sourceId:25577_2
                retElm.setStationGradeId(inductionRecord.getStationGradeId());//SimpleFieldAssign//sourceId:25578_2
                retElm.setStationGradeName(inductionRecord.getStationGradeName());//SimpleFieldAssign//sourceId:25579_2
                retElm.setDirectorInductionRecordId(inductionRecord.getDirectorInductionRecordId());//SimpleFieldAssign//sourceId:25580_2
                retElm.setPositionRoleCode(inductionRecord.getPositionRoleCode());//SimpleFieldAssign//sourceId:25581_2
                retData.getOrgInductionRecordList().add(retElm);
                if (listDept_1 != null) {
                    for (Dept dept : listDept_1) {
                        if (dept.getDeptId().equals(inductionRecord.getEntityId())) {
                            retElm.setDeptCode(dept.getDeptCode());//SimpleFieldAssign//sourceId:35890_2
                            retElm.setLevelNumber(dept.getLevelNumber());//SimpleFieldAssign//sourceId:35891_2
                        }
                    }
                }

            }
        }//sourceId:50257_1
        if (users_1 != null) {
            retData.setUserId(users_1.getUserId());//SimpleFieldAssign//sourceId:45634_1
            retData.setUserName(users_1.getUserName());//SimpleFieldAssign//sourceId:50244_1
            retData.setPhone(users_1.getPhone());//SimpleFieldAssign//sourceId:50252_1
            retData.setPassByPhone(users_1.getPassByPhone());//SimpleFieldAssign//sourceId:50254_1
            retData.setIsUserInfoDone(users_1.getIsUserInfoDone());//SimpleFieldAssign//sourceId:50255_1
        }
        if (originalRoleMember_1 != null) {
            retData.setOriginalRoleMemberId(originalRoleMember_1.getOriginalRoleMemberId());//SimpleFieldAssign//sourceId:62615_1
            retData.setMemberId(originalRoleMember_1.getMemberId());//SimpleFieldAssign//sourceId:50247_1
        }
        if (userinfo_1 != null) {
            retData.setIdCardName(userinfo_1.getIdCardName());//SimpleFieldAssign//sourceId:50243_1
            retData.setUserFace(userinfo_1.getUserFace());//SimpleFieldAssign//sourceId:50245_1
            retData.setNickName(userinfo_1.getNickName());//SimpleFieldAssign//sourceId:50248_1
            retData.setSex(userinfo_1.getSex());//SimpleFieldAssign//sourceId:50250_1
            retData.setBirthday(userinfo_1.getBirthday());//SimpleFieldAssign//sourceId:50251_1
            retData.setCity(userinfo_1.getCity());//SimpleFieldAssign//sourceId:50253_1
        }
        if (originalRoleMemberInfo_1 != null) {
            retData.setRoleMemberCode(originalRoleMemberInfo_1.getRoleMemberCode());//SimpleFieldAssign//sourceId:50246_1
            retData.setPositionIdName(originalRoleMemberInfo_1.getPositionIdName());//SimpleFieldAssign//sourceId:50249_1
        }


        return retData;
    }

    /**
     * D1-用户登录验证[1193]
     * gen by moon at 8/17/2022, 8:01:15 PM
     */
    @Trace(operationName = "D1-用户登录验证")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public UserLoginRespDto userLogin(UserLoginReqDto reqDto) {


        Users users_3 = null;
//virtualUsage 1-2-01查询个人账号详情  2202
        Users users = null;
        QueryUserDetailReq queryUserDetailReq = new QueryUserDetailReq();
        if (reqDto != null) {
            queryUserDetailReq.setUserId(reqDto.getUserId());//sourceId:44256_1_2202
            queryUserDetailReq.setUserName(reqDto.getUserName());//sourceId:44248_1_2202
            queryUserDetailReq.setPhone(reqDto.getPhone());//sourceId:44244_1_2202
        }

        /*1-2-01查询个人账号详情[286]   */

        users = mUsersService.queryUserDetail(queryUserDetailReq);


        if ((users == null)) {
            //if(1-2-01查询个人账号详情.出参 等于空 )  2405

//异常结束 2406
            throw new BizException("10200020", "密码错误，请重试！", false);
        } else if ((users != null && users.getIsInvalid() != null && users.getIsInvalid().equals("TRUE"))) {
            //elseif(1-2-01查询个人账号详情.是否失效 等于 是)  2410

//异常结束 2411
            throw new BizException("10200024", "对不起，账号已失效，请联系管理员！", false);
        }
        if ((users != null && users.getLastLockoutTime() != null)) {
            //if(1-2-01查询个人账号详情.上次被锁定的时间 不等于空 )  2404

//ModelCode: calculationMethod
            CalculationMethodRespDto calculationMethodRes = null;
            if (users != null) {
                CalculationMethodReqDto calculationMethodReq = new CalculationMethodReqDto();
                calculationMethodReq.setThresholdValue(600L);//CUSTOM_CONVENTION//sourceId:45531_1_2407
                if (users != null) {
                    calculationMethodReq.setLastLockoutTime(users.getLastLockoutTime());
                }

                /*M-计算方法（特殊方法）[1577]  入参计算值和阈值，计算结果和阈值比较，返回 true 和 false */

                calculationMethodRes = nbBusinessObject.calculationMethod(calculationMethodReq);


            }
            if ((calculationMethodRes != null && calculationMethodRes.getIsInvalid() != null && calculationMethodRes.getIsInvalid().equals("FALSE"))) {
                //if(计算方法.是否有效 等于 否)  2408

//异常结束 2409
                throw new BizException("10200022", "对不起，账号已锁定，请稍后重试！", false);
            }
        }
//virtualUsage 1-2-09查询身份人员详情  2221
        OriginalRoleMember originalRoleMember = null;
        if (users != null) {
            QueryBeginMemberDetailReq queryBeginMemberDetailReq = new QueryBeginMemberDetailReq();
            queryBeginMemberDetailReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:56773_1_2221
            queryBeginMemberDetailReq.setIsInvalid("FALSE");//sourceId:56790_1_2221
            if (users != null) {
                queryBeginMemberDetailReq.setUserId(users.getUserId());//sourceId:56782_1_2221
            }
            if (reqDto != null) {
                queryBeginMemberDetailReq.setRoleCode(reqDto.getRoleCode());//sourceId:56783_1_2221
                queryBeginMemberDetailReq.setSpaceId(reqDto.getSpaceId());//sourceId:56791_1_2221
            }

            /*1-2-09查询身份人员详情[174]   */

            originalRoleMember = mOriginalRoleMemberService.queryBeginMemberDetail(queryBeginMemberDetailReq);


        }
        if ((originalRoleMember == null)) {
            //if(1-2-09查询身份人员详情.出参 等于空 )  2412

//异常结束 2413
            throw new BizException("10200020", "密码错误，请重试！", false);
        }
//virtualUsage 1-3-13查询就职记录列表  8527
        List<InductionRecord> listInductionRecord = new ArrayList<>();
        if (originalRoleMember != null) {
            QueryInductionRecordListReq queryInductionRecordListReq = new QueryInductionRecordListReq();
            if (originalRoleMember != null) {
                queryInductionRecordListReq.setOriginalRoleMemberId(originalRoleMember.getOriginalRoleMemberId());//sourceId:142158_1_8527
            }

            /*1-3-13查询就职记录列表[166]   */

            listInductionRecord = mInductionRecordService.queryInductionRecordList(queryInductionRecordListReq);


        }
        if ((listInductionRecord != null && listInductionRecord != null && listInductionRecord.size() == 0)) {
            //if(1-3-13查询就职记录列表.就职记录列表数据集条数 等于 0)  8528

//异常结束 8529
            throw new BizException("10200020", "密码错误，请重试！", false);
        }
//virtualUsage 密码验证  1083
        Users users_2 = null;
        QueryUserDetailReq queryUserDetailReq_1 = new QueryUserDetailReq();
        if (reqDto != null) {
            queryUserDetailReq_1.setUserId(reqDto.getUserId());//sourceId:27154_1_1083
            queryUserDetailReq_1.setUserName(reqDto.getUserName());//sourceId:27177_1_1083
            queryUserDetailReq_1.setPhone(reqDto.getPhone());//sourceId:27179_1_1083
            queryUserDetailReq_1.setPassword(reqDto.getPassword());//sourceId:27182_1_1083
        }
  
    /*密码验证[286] 用户登录错误次数判断
登录错误：记录错误密码次数，当超过设置次数时，临时通过Redis设置账号10分钟内锁定  */

        users_2 = mUsersService.queryUserDetail(queryUserDetailReq_1);

        users_3 = users_2;
        if ((users_2 == null && users != null && users.getFailedPasswordAttemptCount() < 5)) {
            //if((密码验证.出参 等于空  and 1-2-01查询个人账号详情.使用无效密码登录次数 小于 5))  1244

            boolean bOOLEAN;
            if (users != null) {
                Users users_4 = new Users();
                if (users != null) {
                    // TODO: 2024/2/3
                    users_4.setUserId(users.getUserId());//SimpleFieldAssign//sourceId:27211_1_2203
                    if (users.getFailedPasswordAttemptCount() != null) {
                        users_4.setFailedPasswordAttemptCount(users.getFailedPasswordAttemptCount() + 1);//AUTO_ADD//sourceId:27212_1_2203
                    } else {
                        users_4.setFailedPasswordAttemptCount(1L);//AUTO_ADD//sourceId:27212_1_2203
                    }
                }

                /*1-2-01修改个人账号（密码错误）[46] 密码错误时，更新错误次数。记录首次无效时间，当首次无效时间为空，更新该字段。账号锁定，更新当前时间，锁定时，将错误次数清零  */
                Assert.isNull(users_4.getUserId(), "D1-用户登录验证-1-2-01修改个人账号（密码错误）-个人账号不能为空", false);
                bOOLEAN = mUsersService.updateUser(users_4);


            }
            if ((users != null && users.getFirstFailedPasswordAttempTime() == null)) {
                //if(1-2-01查询个人账号详情.首次使用无效密码时间 等于空 )  1250

                boolean bOOLEAN_1;
                if (users != null) {
                    Users users_5 = new Users();
                    users_5.setFirstFailedPasswordAttempTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME//sourceId:44284_1_1251
                    if (users != null) {
                        users_5.setUserId(users.getUserId());//sourceId:44283_1_1251
                    }

                    /*1-2-01修改个人账号（首次密码无效时间）[46]   */
                    Assert.isNull(users_5.getUserId(), "D1-用户登录验证-1-2-01修改个人账号（首次密码无效时间）-个人账号不能为空", false);
                    bOOLEAN_1 = mUsersService.updateUser(users_5);


                }
            }
//异常结束 1252
            throw new BizException("10200020", "密码错误，请重试！", false);
        } else if ((users_2 == null && users != null && users.getFailedPasswordAttemptCount() == 5)) {
            //elseif((密码验证.出参 等于空  and 1-2-01查询个人账号详情.使用无效密码登录次数 等于 5))  1245

            boolean bOOLEAN_2;
            if (users != null) {
                Users users_6 = new Users();
                users_6.setLastLockoutTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME//sourceId:44170_1_2204
                users_6.setFailedPasswordAttemptCount(0L);//CUSTOM_CONVENTION//sourceId:44160_1_2204
                if (users != null) {
                    users_6.setUserId(users.getUserId());//sourceId:44250_1_2204
                }

                /*1-2-01修改个人账号（锁定账号）[46]   */
                Assert.isNull(users_6.getUserId(), "D1-用户登录验证-1-2-01修改个人账号（锁定账号）-个人账号不能为空", false);
                bOOLEAN_2 = mUsersService.updateUser(users_6);


            }
//异常结束 1255
            throw new BizException("10200021", "对不起，由于您输入的密码错误次数过多，账号已锁定！", false);
        } else {
            //else  1247

            boolean bOOLEAN_3;
            if (users != null) {
                Users users_7 = new Users();
                users_7.setLastLoginIp(CommonFunctionHelper.getLogInIp());//LOGIN_IP//sourceId:27234_1_2208
                users_7.setLastLoginTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME//sourceId:27235_1_2208
                users_7.setFailedPasswordAttemptCount(0L);//CUSTOM_CONVENTION//sourceId:27236_1_2208
                users_7.setIsInvalid("FALSE");//sourceId:44251_1_2208
                if (users_7 != null && users_7.getIsInvalid() != null && users_7.getIsInvalid().equals("FALSE")) {
                    users_7.setInvalidTime(null);
                }//sourceId:44254_1_2208
                if (users != null) {
                    users_7.setUserId(users.getUserId());//sourceId:27233_1_2208
                }

                /*1-2-01修改个人账号（密码正确）[46]   */
                Assert.isNull(users_7.getUserId(), "D1-用户登录验证-1-2-01修改个人账号（密码正确）-个人账号不能为空", false);
                bOOLEAN_3 = mUsersService.updateUser(users_7);


            }
//processBranchName:正常结束 ,processBranchId:2209

        }
        UserLoginRespDto retData = new UserLoginRespDto();
        if (users_3 != null) {
            retData.setUserId(users_3.getUserId());//sourceId:34388_1
            retData.setFailedPasswordAttemptCount(users_3.getFailedPasswordAttemptCount());//sourceId:27774_1
            retData.setIsInvalid(users_3.getIsInvalid());//sourceId:27775_1
            retData.setInvalidType(users_3.getInvalidType());//sourceId:27776_1
            retData.setInvalidReason(users_3.getInvalidReason());//sourceId:27777_1
            retData.setAppId(users_3.getAppId());//sourceId:203086_1
        }


        return retData;
    }

    /**
     * D1-工号信息验证[1192]
     * gen by moon at 10/2/2022, 12:00:48 AM
     */
    @Trace(operationName = "D1-工号信息验证")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public CheckLoginNumberRespDto checkLoginNumber(CheckLoginNumberReqDto reqDto) {


        OriginalRoleMemberInfo originalRoleMemberInfo_1 = null;
        OriginalRoleMember originalRoleMember_1 = null;
//virtualUsage 1-2-10查询身份人员资料详情  1077
        OriginalRoleMemberInfo originalRoleMemberInfo = null;
        QueryBeginMembInfoDetailReq queryBeginMembInfoDetailReq = new QueryBeginMembInfoDetailReq();
        if (reqDto != null) {
            queryBeginMembInfoDetailReq.setRoleMemberCode(reqDto.getRoleMemberCode());//SimpleFieldAssign//sourceId:27113_1_1077
            queryBeginMembInfoDetailReq.setSpaceId(reqDto.getSpaceId());//SimpleFieldAssign//sourceId:27114_1_1077
        }

        /*1-2-10查询身份人员资料详情[116]   */

        originalRoleMemberInfo = mOriginalRoleMemberInfoService.queryBeginMembInfoDetail(queryBeginMembInfoDetailReq);


        originalRoleMemberInfo_1 = originalRoleMemberInfo;
        if ((originalRoleMemberInfo != null)) {
            //if(1-2-10查询身份人员资料详情.出参 值不等于空 )  1078

            OriginalRoleMember originalRoleMember = null;
            if (originalRoleMemberInfo != null) {
                QueryBeginMemberDetailReq queryBeginMemberDetailReq = new QueryBeginMemberDetailReq();
                if (originalRoleMemberInfo != null) {
                    queryBeginMemberDetailReq.setOriginalRoleMemberId(originalRoleMemberInfo.getOriginalRoleMemberId());//SimpleFieldAssign//sourceId:27146_1_1079
                }
                if (reqDto != null) {
                    queryBeginMemberDetailReq.setRoleCode(reqDto.getRoleCode());//SimpleFieldAssign//sourceId:27147_1_1079
                }

                /*1-2-09查询身份人员详情[174]   */
                Assert.isNull(queryBeginMemberDetailReq.getOriginalRoleMemberId(), "D1-工号信息验证-1-2-09查询身份人员详情-身份人员ID不能为空", false);
                Assert.isNull(queryBeginMemberDetailReq.getRoleCode(), "D1-工号信息验证-1-2-09查询身份人员详情-身份角色编码不能为空", false);
                originalRoleMember = mOriginalRoleMemberService.queryBeginMemberDetail(queryBeginMemberDetailReq);

                originalRoleMember_1 = originalRoleMember;
            }
            if ((originalRoleMember != null && originalRoleMember.getIsInvalid() != null && originalRoleMember.getIsInvalid().equals("TRUE"))) {
                //if(1-2-09查询身份人员详情.是否失效 等于 是)  1279

//异常结束 1280
                throw new BizException("10200024", "对不起，账号已失效，请联系管理员！", false);
            } else {
                //else  1281

//processBranchName:正常结束 ,processBranchId:1282

            }
        } else {
            //else  1080

//异常结束 1081
            throw new BizException("500", "系统异常，请联系管理员！", false);
        }
        CheckLoginNumberRespDto retData = new CheckLoginNumberRespDto();
        if (originalRoleMember_1 != null) {
            retData.setUserId(originalRoleMember_1.getUserId());//SimpleFieldAssign//sourceId:27752_1
        }
        if (originalRoleMemberInfo_1 != null) {
            retData.setOriginalRoleMemberId(originalRoleMemberInfo_1.getOriginalRoleMemberId());//SimpleFieldAssign//sourceId:27753_1
        }


        return retData;
    }

    /**
     * D1-1批量查询业务对象列表（集合公用）[650]
     * gen by moon at 8/10/2022, 3:24:44 AM
     */
    @Trace(operationName = "D1-1批量查询业务对象列表（集合公用）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public BatchQueryBizObjectListRespDto batchQueryBizObjectList(BatchQueryBizObjectListReqDto reqDto) {


        List<MetadataBusinessObject> listMetadataBusinessObject_1 = new ArrayList<>();
//步骤0: 1-1-03批量查询业务对象名称列表（集合公用） - batchQueryBizObjectNamesList
        List<MetadataBusinessObject> listMetadataBusinessObject = new ArrayList<>();
        BatchQueryBizObjectNamesListReq batchQueryBizObjectNamesListReq = new BatchQueryBizObjectNamesListReq();
        if (reqDto != null) {
            batchQueryBizObjectNamesListReq.setBusinessObjectIdList(reqDto.getBusinessObjectIdList());//sourceId:11116_1
        }

        /*1-1-03批量查询业务对象名称列表（集合公用）[651]   */

        listMetadataBusinessObject = mMetadataBusinessObjectService.batchQueryBizObjectNamesList(batchQueryBizObjectNamesListReq);

        listMetadataBusinessObject_1 = listMetadataBusinessObject;

        BatchQueryBizObjectListRespDto retData = new BatchQueryBizObjectListRespDto();
        retData.setBusinessObjectNameList(listMetadataBusinessObject_1.stream().map(item -> BeanUtil.toBean(item, BusinessObjectNameDto.class)).collect(Collectors.toList()));//sourceId:11118_1


        return retData;
    }

    /**
     * D1-1查询对象属性类型关系列表[384]
     * gen by moon at 10/2/2022, 4:09:28 AM
     */
    @Trace(operationName = "D1-1查询对象属性类型关系列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryObjTypeRelationListRespDto queryObjTypeRelationList(QueryObjTypeRelationListReqDto reqDto) {


        List<MetadataPropertyType> listMetadataPropertyType_1 = new ArrayList<>();
        List<MetadataType> listMetadataType_1 = new ArrayList<>();
//步骤0: 1-1-12查询对象属性类型关系列表 - queryObjTypeRelationList
        List<MetadataPropertyType> listMetadataPropertyType = new ArrayList<>();
        QueryObjTypeRelationListReq queryObjTypeRelationListReq = new QueryObjTypeRelationListReq();
        if (reqDto != null) {
            queryObjTypeRelationListReq.setObjectPropertyId(reqDto.getObjectPropertyId());//SimpleFieldAssign//sourceId:10704_1
            queryObjTypeRelationListReq.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:14650_1
            queryObjTypeRelationListReq.setIsArchive(reqDto.getIsArchive());//SimpleFieldAssign//sourceId:15163_1
        }

        /*第一步，查询对象属性类型关系列表，出参类型ID[88]   */
        Assert.isNull(queryObjTypeRelationListReq.getObjectPropertyId(), "D1-1查询对象属性类型关系列表-第一步，查询对象属性类型关系列表，出参类型ID-对象属性ID不能为空", false);
        listMetadataPropertyType = mMetadataPropertyTypeService.queryObjTypeRelationList(queryObjTypeRelationListReq);

        listMetadataPropertyType_1 = listMetadataPropertyType;

//步骤1: 1-1-05批量查询类型列表 - batchQueryTypeList
        List<MetadataType> listMetadataType = new ArrayList<>();
        if (listMetadataPropertyType != null && listMetadataPropertyType.size() > 0 && listMetadataPropertyType != null && listMetadataPropertyType != null && listMetadataPropertyType.size() > 0) {
            BatchQueryTypeListReq batchQueryTypeListReq = new BatchQueryTypeListReq();
            batchQueryTypeListReq.setTypeList(listMetadataPropertyType.stream().map(item -> item.getTypeId())
                    .collect(Collectors.toList()));/*list-to-strings*///sourceId:11341_1

            /*根据上一步的出参类型ID作为第二步入参，查询类型列表[655]   */

            listMetadataType = mMetadataTypeService.batchQueryTypeList(batchQueryTypeListReq);

            listMetadataType_1 = listMetadataType;
        }

        QueryObjTypeRelationListRespDto retData = new QueryObjTypeRelationListRespDto();
        //数据集融合  MoreListToOneSource
        if (listMetadataPropertyType_1 != null && !CollectionUtil.isEmpty(listMetadataPropertyType_1)) {
            for (MetadataPropertyType metadataPropertyType : listMetadataPropertyType_1) {
                ObjectPropertyDto retElm = new ObjectPropertyDto();
                retElm.setObjectPropertyTypeId(metadataPropertyType.getObjectPropertyTypeId());//SimpleFieldAssign//sourceId:15645_2
                retElm.setTypeId(metadataPropertyType.getTypeId());//SimpleFieldAssign//sourceId:15647_2
                retElm.setSubjectLifeCycle(metadataPropertyType.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:15649_2
                retElm.setIsArchive(metadataPropertyType.getIsArchive());//SimpleFieldAssign//sourceId:35738_2
                retElm.setOrderNumber(metadataPropertyType.getOrderNumber());//SimpleFieldAssign//sourceId:15650_2
                retElm.setOperationInductionId(metadataPropertyType.getOperationInductionId());//SimpleFieldAssign//sourceId:15651_2
                retElm.setOperateTime(metadataPropertyType.getOperateTime());//SimpleFieldAssign//sourceId:15652_2
                retData.getObjectPropertyList().add(retElm);
                if (listMetadataType_1 != null) {
                    for (MetadataType metadataType : listMetadataType_1) {
                        if (metadataType.getTypeId().equals(metadataPropertyType.getTypeId())) {
                            retElm.setTypeCode(metadataType.getTypeCode());//SimpleFieldAssign//sourceId:15646_2
                            retElm.setTypeName(metadataType.getTypeName());//SimpleFieldAssign//sourceId:15648_2
                        }
                    }
                }

            }
        }//sourceId:34805_1


        return retData;
    }

    /**
     * D1-1查询对象属性列表[352]
     * gen by moon at 9/11/2022, 5:11:27 AM
     */
    @Trace(operationName = "D1-1查询对象属性列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryObjAttributeListRespDto queryObjAttributeList(QueryObjAttributeListReqDto reqDto) {


        List<MetadataObjectProperty> listMetadataObjectProperty_1 = new ArrayList<>();
//步骤0: 1-1-04查询对象属性列表 - queryObjAttributeList
        List<MetadataObjectProperty> listMetadataObjectProperty = new ArrayList<>();
        QueryObjAttributeListReq queryObjAttributeListReq = new QueryObjAttributeListReq();
        if (reqDto != null) {
            queryObjAttributeListReq.setBusinessObjectId(reqDto.getBusinessObjectId());//sourceId:10693_1
            queryObjAttributeListReq.setBusinessObjectCode(reqDto.getBusinessObjectCode());//sourceId:21179_1
            queryObjAttributeListReq.setObjectPropertyTypeCode(reqDto.getObjectPropertyTypeCode());//sourceId:11066_1
            queryObjAttributeListReq.setObjectPropertyName(reqDto.getObjectPropertyName());//sourceId:33654_1
            queryObjAttributeListReq.setIsEnumeration(reqDto.getIsEnumeration());//sourceId:11067_1
            queryObjAttributeListReq.setIsStatus(reqDto.getIsStatus());//sourceId:25234_1
            queryObjAttributeListReq.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//sourceId:14281_1
            queryObjAttributeListReq.setIsArchive(reqDto.getIsArchive());//sourceId:15119_1
        }

        /*1-1-04查询对象属性列表[220]   */

        listMetadataObjectProperty = mMetadataObjectPropertyService.queryObjAttributeList(queryObjAttributeListReq);

        listMetadataObjectProperty_1 = listMetadataObjectProperty;

        QueryObjAttributeListRespDto retData = new QueryObjAttributeListRespDto();
        retData.setBaseMetadataObjectPropertyList(listMetadataObjectProperty_1.stream().map(item -> BeanUtil.toBean(item, BaseMetadataObjectPropertyDto.class)).collect(Collectors.toList()));//sourceId:10695_1


        return retData;
    }

    /**
     * D1-1查询业务对象列表[340]
     * gen by moon at 8/31/2022, 7:27:02 PM
     */
    @Trace(operationName = "D1-1查询业务对象列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryBizObjectListRespDto queryBizObjectList(QueryBizObjectListReqDto reqDto) {


        List<MetadataBusinessObject> listMetadataBusinessObject_1 = new ArrayList<>();
//步骤0: 1-1-03查询业务对象列表 - queryBizObjectList
        List<MetadataBusinessObject> listMetadataBusinessObject = new ArrayList<>();
        QueryBizObjectListReq queryBizObjectListReq = new QueryBizObjectListReq();
        if (reqDto != null) {
            queryBizObjectListReq.setBusinessObjectCnName(reqDto.getBusinessObjectCnName());//sourceId:9574_1
            queryBizObjectListReq.setBusinessObjectTypeCode(reqDto.getBusinessObjectTypeCode());//sourceId:9575_1
            queryBizObjectListReq.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//sourceId:9586_1
            queryBizObjectListReq.setIsArchive(reqDto.getIsArchive());//sourceId:15109_1
        }

        /*1-1-03查询业务对象列表[219]   */
        Assert.isNull(queryBizObjectListReq.getIsArchive(), "D1-1查询业务对象列表-1-1-03查询业务对象列表-是否存档不能为空", false);
        listMetadataBusinessObject = mMetadataBusinessObjectService.queryBizObjectList(queryBizObjectListReq);

        listMetadataBusinessObject_1 = listMetadataBusinessObject;

        QueryBizObjectListRespDto retData = new QueryBizObjectListRespDto();
        retData.setBaseMetadataBusinessObjectList(listMetadataBusinessObject_1.stream().map(item -> BeanUtil.toBean(item, BaseMetadataBusinessObjectDto.class)).collect(Collectors.toList()));//sourceId:9617_1


        return retData;
    }

    /**
     * 登录成功生成Token[1034]
     * gen by moon at 8/17/2022, 8:01:11 PM
     */
    @Trace(operationName = "登录成功生成Token")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public CreateTokenRespDto createToken(CreateTokenReqDto reqDto) {


        GenerateTokenRespDto generateTokenRes_1 = null;
//步骤0: M-生成Token（特殊方法） - generateToken
        //ModelCode: generateToken
        GenerateTokenRespDto generateTokenRes = null;
        GenerateTokenReqDto generateTokenReq = new GenerateTokenReqDto();


        /*M-生成Token（特殊方法）[1533]  用于前端用户登录时生成tokenId */

        generateTokenRes = nbBusinessObject.generateToken(generateTokenReq);

        generateTokenRes_1 = generateTokenRes;

        CreateTokenRespDto retData = new CreateTokenRespDto();
        if (generateTokenRes_1 != null) {
            retData.setToken(generateTokenRes_1.getToken());//sourceId:43368_1
        }


        return retData;
    }

    /**
     * D1-1查询对象属性详情[653]
     * gen by moon at 8/10/2022, 3:24:46 AM
     */
    @Trace(operationName = "D1-1查询对象属性详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryObjAttributeDetailRespDto queryObjAttributeDetail(QueryObjAttributeDetailReqDto reqDto) {


        MetadataObjectProperty metadataObjectProperty_1 = null;
//步骤0: 1-1-04查询对象属性详情 - queryObjAttributeDetail
        MetadataObjectProperty metadataObjectProperty = null;
        QueryObjAttributeDetailReq queryObjAttributeDetailReq = new QueryObjAttributeDetailReq();
        if (reqDto != null) {
            queryObjAttributeDetailReq.setObjectPropertyId(reqDto.getObjectPropertyId());//sourceId:11133_1
            queryObjAttributeDetailReq.setObjectPropertyCode(reqDto.getObjectPropertyCode());//sourceId:11159_1
        }

        /*1-1-04查询对象属性详情[16]   */

        metadataObjectProperty = mMetadataObjectPropertyService.queryObjAttributeDetail(queryObjAttributeDetailReq);

        metadataObjectProperty_1 = metadataObjectProperty;

        QueryObjAttributeDetailRespDto retData = new QueryObjAttributeDetailRespDto();
        if (metadataObjectProperty_1 != null) {
            retData.setObjectPropertyId(metadataObjectProperty_1.getObjectPropertyId());//sourceId:11163_1
            retData.setBusinessObjectId(metadataObjectProperty_1.getBusinessObjectId());//sourceId:11164_1
            retData.setBusinessObjectCode(metadataObjectProperty_1.getBusinessObjectCode());//sourceId:21207_1
            retData.setObjectPropertyCode(metadataObjectProperty_1.getObjectPropertyCode());//sourceId:11165_1
            retData.setObjectPropertyName(metadataObjectProperty_1.getObjectPropertyName());//sourceId:11166_1
            retData.setObjectPropertyTypeCode(metadataObjectProperty_1.getObjectPropertyTypeCode());//sourceId:11167_1
            retData.setIsEnumeration(metadataObjectProperty_1.getIsEnumeration());//sourceId:11168_1
            retData.setIsStatus(metadataObjectProperty_1.getIsStatus());//sourceId:11169_1
            retData.setIsPrimaryKey(metadataObjectProperty_1.getIsPrimaryKey());//sourceId:11170_1
            retData.setIsRecordVersion(metadataObjectProperty_1.getIsRecordVersion());//sourceId:34520_1
            retData.setObjectPropertyAlias(metadataObjectProperty_1.getObjectPropertyAlias());//sourceId:11173_1
            retData.setOrderNumber(metadataObjectProperty_1.getOrderNumber());//sourceId:11174_1
            retData.setOperationInductionId(metadataObjectProperty_1.getOperationInductionId());//sourceId:11176_1
            retData.setOperateTime(metadataObjectProperty_1.getOperateTime());//sourceId:11177_1
            retData.setSubjectLifeCycle(metadataObjectProperty_1.getSubjectLifeCycle());//sourceId:11178_1
        }


        return retData;
    }

    /**
     * D1-1修改对象属性类型关系[533]
     * gen by moon at 8/10/2022, 3:23:43 AM
     */
    @Trace(operationName = "D1-1修改对象属性类型关系")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public UpdateObjTypeRelationRespDto updateObjTypeRelation(UpdateObjTypeRelationReqDto reqDto) {


        //步骤0: 1-1-12修改对象属性类型关系 - updateObjTypeRelation
        boolean bOOLEAN;
        MetadataPropertyType metadataPropertyType = new MetadataPropertyType();
        if (reqDto != null) {
            metadataPropertyType.setObjectPropertyTypeId(reqDto.getObjectPropertyTypeId());//sourceId:10227_1
            metadataPropertyType.setOrderNumber(reqDto.getOrderNumber());//sourceId:11372_1
            metadataPropertyType.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//sourceId:14664_1
        }

        /*1-1-12修改对象属性类型关系[86]   */

        bOOLEAN = mMetadataPropertyTypeService.updateObjTypeRelation(metadataPropertyType);


        UpdateObjTypeRelationRespDto retData = new UpdateObjTypeRelationRespDto();


        return retData;
    }

    /**
     * D1-1新增对象属性类型关系[526]
     * gen by moon at 8/10/2022, 3:23:41 AM
     */
    @Trace(operationName = "D1-1新增对象属性类型关系")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public AddObjTypeRelationRespDto addObjTypeRelation(AddObjTypeRelationReqDto reqDto) {


        String string_1 = null;
//步骤0: 1-1-12新增对象属性类型关系 - addObjTypeRelation
        String string = null;
        MetadataPropertyType metadataPropertyType = new MetadataPropertyType();
        if (reqDto != null) {
            metadataPropertyType.setObjectPropertyId(reqDto.getObjectPropertyId());//sourceId:9858_1
            metadataPropertyType.setTypeId(reqDto.getTypeId());//sourceId:9857_1
            metadataPropertyType.setOrderNumber(reqDto.getOrderNumber());//sourceId:11359_1
            metadataPropertyType.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//sourceId:14657_1
        }

        /*1-1-12新增对象属性类型关系[85]   */
        Assert.isNull(metadataPropertyType.getObjectPropertyId(), "D1-1新增对象属性类型关系-1-1-12新增对象属性类型关系-对象属性ID不能为空", false);
        Assert.isNull(metadataPropertyType.getTypeId(), "D1-1新增对象属性类型关系-1-1-12新增对象属性类型关系-类型ID不能为空", false);
        Assert.isNull(metadataPropertyType.getOrderNumber(), "D1-1新增对象属性类型关系-1-1-12新增对象属性类型关系-排序不能为空", false);
        Assert.isNull(metadataPropertyType.getSubjectLifeCycle(), "D1-1新增对象属性类型关系-1-1-12新增对象属性类型关系-主体生命周期不能为空", false);
        string = mMetadataPropertyTypeService.addObjTypeRelation(metadataPropertyType);

        string_1 = string;

        AddObjTypeRelationRespDto retData = new AddObjTypeRelationRespDto();
        if (string_1 != null) {
            retData.setObjectPropertyTypeId(string_1);//sourceId:28317_1
        }


        return retData;
    }

    /**
     * D1-1修改对象属性[348]
     * gen by moon at 9/11/2022, 5:11:25 AM
     */
    @Trace(operationName = "D1-1修改对象属性")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public UpdateObjAttributeRespDto updateObjAttribute(UpdateObjAttributeReqDto reqDto) {


        //步骤0: 1-1-04修改对象属性 - updateObjAttribute
        boolean bOOLEAN;
        MetadataObjectProperty metadataObjectProperty = new MetadataObjectProperty();
        if (reqDto != null) {
            metadataObjectProperty.setObjectPropertyId(reqDto.getObjectPropertyId());//sourceId:10118_1
            metadataObjectProperty.setObjectPropertyCode(reqDto.getObjectPropertyCode());//sourceId:10119_1
            metadataObjectProperty.setObjectPropertyName(reqDto.getObjectPropertyName());//sourceId:10120_1
            metadataObjectProperty.setObjectPropertyTypeCode(reqDto.getObjectPropertyTypeCode());//sourceId:10121_1
            metadataObjectProperty.setIsEnumeration(reqDto.getIsEnumeration());//sourceId:10122_1
            metadataObjectProperty.setIsStatus(reqDto.getIsStatus());//sourceId:25285_1
            metadataObjectProperty.setIsPrimaryKey(reqDto.getIsPrimaryKey());//sourceId:10124_1
            metadataObjectProperty.setObjectPropertyAlias(reqDto.getObjectPropertyAlias());//sourceId:10127_1
            metadataObjectProperty.setIsRecordVersion(reqDto.getIsRecordVersion());//sourceId:287636_1
            metadataObjectProperty.setOrderNumber(reqDto.getOrderNumber());//sourceId:10128_1
            metadataObjectProperty.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//sourceId:14272_1
        }

        /*1-1-04修改对象属性[14]   */
        Assert.isNull(metadataObjectProperty.getObjectPropertyId(), "D1-1修改对象属性-1-1-04修改对象属性-对象属性ID不能为空", false);
        bOOLEAN = mMetadataObjectPropertyService.updateObjAttribute(metadataObjectProperty);


        UpdateObjAttributeRespDto retData = new UpdateObjAttributeRespDto();


        return retData;
    }

    /**
     * D1-1新增对象属性[347]
     * gen by moon at 9/2/2022, 2:58:34 PM
     */
    @Trace(operationName = "D1-1新增对象属性")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public AddObjAttributeRespDto addObjAttribute(AddObjAttributeReqDto reqDto) {


        String string_1 = null;
//步骤0: 1-1-04新增对象属性 - addObjAttribute
        String string = null;
        MetadataObjectProperty metadataObjectProperty = new MetadataObjectProperty();
        if (reqDto != null) {
            metadataObjectProperty.setBusinessObjectId(reqDto.getBusinessObjectId());//sourceId:9736_1
            metadataObjectProperty.setBusinessObjectCode(reqDto.getBusinessObjectCode());//sourceId:21175_1
            metadataObjectProperty.setObjectPropertyCode(reqDto.getObjectPropertyCode());//sourceId:9737_1
            metadataObjectProperty.setObjectPropertyName(reqDto.getObjectPropertyName());//sourceId:9738_1
            metadataObjectProperty.setObjectPropertyTypeCode(reqDto.getObjectPropertyTypeCode());//sourceId:9739_1
            metadataObjectProperty.setIsEnumeration(reqDto.getIsEnumeration());//sourceId:9740_1
            metadataObjectProperty.setIsStatus(reqDto.getIsStatus());//sourceId:61625_1
            metadataObjectProperty.setIsPrimaryKey(reqDto.getIsPrimaryKey());//sourceId:9742_1
            metadataObjectProperty.setObjectPropertyAlias(reqDto.getObjectPropertyAlias());//sourceId:9745_1
            metadataObjectProperty.setIsRecordVersion(reqDto.getIsRecordVersion());//sourceId:28061_1
            metadataObjectProperty.setOrderNumber(reqDto.getOrderNumber());//sourceId:9746_1
            metadataObjectProperty.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//sourceId:14246_1
        }

        /*1-1-04新增对象属性[13]   */
        Assert.isNull(metadataObjectProperty.getBusinessObjectId(), "D1-1新增对象属性-1-1-04新增对象属性-业务对象ID不能为空", false);
        Assert.isNull(metadataObjectProperty.getBusinessObjectCode(), "D1-1新增对象属性-1-1-04新增对象属性-业务对象编码不能为空", false);
        Assert.isNull(metadataObjectProperty.getObjectPropertyCode(), "D1-1新增对象属性-1-1-04新增对象属性-对象属性标识不能为空", false);
        Assert.isNull(metadataObjectProperty.getObjectPropertyName(), "D1-1新增对象属性-1-1-04新增对象属性-对象属性名称不能为空", false);
        Assert.isNull(metadataObjectProperty.getObjectPropertyTypeCode(), "D1-1新增对象属性-1-1-04新增对象属性-对象属性类型不能为空", false);
        Assert.isNull(metadataObjectProperty.getOrderNumber(), "D1-1新增对象属性-1-1-04新增对象属性-排序不能为空", false);
        Assert.isNull(metadataObjectProperty.getSubjectLifeCycle(), "D1-1新增对象属性-1-1-04新增对象属性-主体生命周期不能为空", false);
        string = mMetadataObjectPropertyService.addObjAttribute(metadataObjectProperty);


        string_1 = string;

        AddObjAttributeRespDto retData = new AddObjAttributeRespDto();
        if (string_1 != null) {
            retData.setObjectPropertyId(string_1);//sourceId:28393_1
        }


        return retData;
    }

    /**
     * D1-1查询业务对象详情[341]
     * gen by moon at 8/10/2022, 3:22:03 AM
     */
    @Trace(operationName = "D1-1查询业务对象详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryBizObjectDetailRespDto queryBizObjectDetail(QueryBizObjectDetailReqDto reqDto) {


        MetadataBusinessObject metadataBusinessObject_1 = null;
//步骤0: 1-1-03查询业务对象详情 - queryBizObjectDetail
        MetadataBusinessObject metadataBusinessObject = null;
        QueryBizObjectDetailReq queryBizObjectDetailReq = new QueryBizObjectDetailReq();
        if (reqDto != null) {
            queryBizObjectDetailReq.setBusinessObjectId(reqDto.getBusinessObjectId());//sourceId:9021_1
            queryBizObjectDetailReq.setBusinessObjectCode(reqDto.getBusinessObjectCode());//sourceId:9022_1
        }

        /*1-1-03查询业务对象详情[12]   */

        metadataBusinessObject = mMetadataBusinessObjectService.queryBizObjectDetail(queryBizObjectDetailReq);

        metadataBusinessObject_1 = metadataBusinessObject;

        QueryBizObjectDetailRespDto retData = new QueryBizObjectDetailRespDto();
        if (metadataBusinessObject_1 != null) {
            retData.setBusinessObjectId(metadataBusinessObject_1.getBusinessObjectId());//sourceId:9044_1
            retData.setBusinessObjectCnName(metadataBusinessObject_1.getBusinessObjectCnName());//sourceId:9045_1
            retData.setBusinessObjectCode(metadataBusinessObject_1.getBusinessObjectCode());//sourceId:9046_1
            retData.setBusinessObjectTypeCode(metadataBusinessObject_1.getBusinessObjectTypeCode());//sourceId:9047_1
            retData.setSubjectLifeCycle(metadataBusinessObject_1.getSubjectLifeCycle());//sourceId:9052_1
            retData.setOperationInductionId(metadataBusinessObject_1.getOperationInductionId());//sourceId:9050_1
            retData.setCreateInductionId(metadataBusinessObject_1.getCreateInductionId());//sourceId:9055_1
            retData.setReleaseInductionId(metadataBusinessObject_1.getReleaseInductionId());//sourceId:34348_1
            retData.setArchiveInductionId(metadataBusinessObject_1.getArchiveInductionId());//sourceId:34349_1
            retData.setOperateTime(metadataBusinessObject_1.getOperateTime());//sourceId:9051_1
            retData.setCreateTime(metadataBusinessObject_1.getCreateTime());//sourceId:34350_1
            retData.setReleaseTime(metadataBusinessObject_1.getReleaseTime());//sourceId:34351_1
            retData.setArchiveTime(metadataBusinessObject_1.getArchiveTime());//sourceId:34352_1
        }


        return retData;
    }

    /**
     * D1-1修改业务对象[337]
     * gen by moon at 8/10/2022, 3:21:59 AM
     */
    @Trace(operationName = "D1-1修改业务对象")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public UpdateBizObjectRespDto updateBizObject(UpdateBizObjectReqDto reqDto) {


        //步骤0: 1-1-03修改业务对象	 - updateBizObject
        boolean bOOLEAN;
        MetadataBusinessObject metadataBusinessObject = new MetadataBusinessObject();
        if (reqDto != null) {
            metadataBusinessObject.setBusinessObjectId(reqDto.getBusinessObjectId());//sourceId:8969_1
            metadataBusinessObject.setBusinessObjectCnName(reqDto.getBusinessObjectCnName());//sourceId:8970_1
            metadataBusinessObject.setBusinessObjectCode(reqDto.getBusinessObjectCode());//sourceId:8971_1
            metadataBusinessObject.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//sourceId:14019_1
        }

        /*1-1-03修改业务对象	[10]   */

        bOOLEAN = mMetadataBusinessObjectService.updateBizObject(metadataBusinessObject);


        UpdateBizObjectRespDto retData = new UpdateBizObjectRespDto();


        return retData;
    }

    /**
     * D1-1新增业务对象[336]
     * gen by moon at 8/10/2022, 3:21:57 AM
     */
    @Trace(operationName = "D1-1新增业务对象")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public AddBizObjectRespDto addBizObject(AddBizObjectReqDto reqDto) {


        String string_1 = null;
//步骤0: 1-1-03新增业务对象 - addBizObject
        String string = null;
        MetadataBusinessObject metadataBusinessObject = new MetadataBusinessObject();
        if (reqDto != null) {
            metadataBusinessObject.setBusinessObjectCnName(reqDto.getBusinessObjectCnName());//sourceId:8258_1
            metadataBusinessObject.setBusinessObjectCode(reqDto.getBusinessObjectCode());//sourceId:8259_1
            metadataBusinessObject.setBusinessObjectTypeCode(reqDto.getBusinessObjectTypeCode());//sourceId:8260_1
            metadataBusinessObject.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//sourceId:14014_1
        }

        /*1-1-03新增业务对象[9]   */
        Assert.isNull(metadataBusinessObject.getBusinessObjectCnName(), "D1-1新增业务对象-1-1-03新增业务对象-业务对象中文名不能为空", false);
        Assert.isNull(metadataBusinessObject.getBusinessObjectCode(), "D1-1新增业务对象-1-1-03新增业务对象-业务对象编码不能为空", false);
        Assert.isNull(metadataBusinessObject.getBusinessObjectTypeCode(), "D1-1新增业务对象-1-1-03新增业务对象-业务对象类型编码不能为空", false);
        Assert.isNull(metadataBusinessObject.getSubjectLifeCycle(), "D1-1新增业务对象-1-1-03新增业务对象-主体生命周期不能为空", false);
        string = mMetadataBusinessObjectService.addBizObject(metadataBusinessObject);

        string_1 = string;

        AddBizObjectRespDto retData = new AddBizObjectRespDto();
        if (string_1 != null) {
            retData.setBusinessObjectId(string_1);//sourceId:28313_1
        }


        return retData;
    }

    /**
     * D1-1删除业务场景---待删除[757]
     */
    @Trace(operationName = "D1-1删除业务场景---待删除")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public DeleteBizSceneRespDto deleteBizScene(DeleteBizSceneReqDto reqDto) {


        //步骤0: 1-1-09删除业务场景	 - deleteBizScene
        boolean bOOLEAN;
        String string = new String();
        if (reqDto != null) {
            string = reqDto.getBizSceneId();
            ;//sourceId:25896_1
        }

        /*1-1-09删除业务场景	[39]   */
        bOOLEAN = mBizSceneService.deleteBizScene(string);


        DeleteBizSceneRespDto retData = new DeleteBizSceneRespDto();


        return retData;
    }

    /**
     * D1-1删除业务应用---待删除[747]
     */
    @Trace(operationName = "D1-1删除业务应用---待删除")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public DeleteBizAppSceneRespDto deleteBizAppScene(DeleteBizAppSceneReqDto reqDto) {


        //步骤0: 1-1-07删除业务应用	 - deleteBizAppScene
        boolean bOOLEAN;
        String string = new String();
        if (reqDto != null) {
            string = reqDto.getBizAppId();
            ;//sourceId:20952_1
        }

        /*1-1-07删除业务应用	[31]   */
        bOOLEAN = mBizAppSceneService.deleteBizAppScene(string);


        DeleteBizAppSceneRespDto retData = new DeleteBizAppSceneRespDto();


        return retData;
    }

    /**
     * D1-1删除对象属性类型关系[529]
     */
    @Trace(operationName = "D1-1删除对象属性类型关系")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public DeleteObjTypeRelationRespDto deleteObjTypeRelation(DeleteObjTypeRelationReqDto reqDto) {


        //步骤0: 1-1-12删除对象属性类型关系 - deleteObjTypeRelation
        boolean bOOLEAN;
        String string = new String();
        if (reqDto != null) {
            string = reqDto.getObjectPropertyTypeId();
            ;//sourceId:10431_1
        }

        /*1-1-12删除对象属性类型关系[87]   */
        bOOLEAN = mMetadataPropertyTypeService.deleteObjTypeRelation(string);


        DeleteObjTypeRelationRespDto retData = new DeleteObjTypeRelationRespDto();


        return retData;
    }

    /**
     * D1-3新增就职记录[403]
     * gen by moon at 2022/7/3 下午5:26:41
     */
    @Trace(operationName = "D1-3新增就职记录")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public AddInductionRecordRespDto addInductionRecord(AddInductionRecordReqDto reqDto) {
        // TODO: 2022/7/27 胡睿哲:手写代码
        QueryDeptDetailReqDto queryDeptDetailReqDto = new QueryDeptDetailReqDto();
        queryDeptDetailReqDto.setDeptId(reqDto.getEntityId());
        QueryDeptDetailRespDto queryDeptDetailRespDto = orgService.queryDeptDetail(queryDeptDetailReqDto);
        if (queryDeptDetailRespDto != null) {
            reqDto.setDeptShortName(queryDeptDetailRespDto.getDeptName());
        }

        String string_1 = null;
//virtualUsage 1-3-05查询职务详情  1707
        Position position = null;
        QueryPositionDetailReq queryPositionDetailReq = new QueryPositionDetailReq();
        queryPositionDetailReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:51301_1_1707
        if (reqDto != null) {
            queryPositionDetailReq.setPositionId(reqDto.getPositionId());//sourceId:22795_1_1707
        }

        /*1-3-05查询职务详情[146] 根据BFF入参职务ID是否有值，有值就查询当前入参的职务ID、存档类型为未存档，查询返回结果有值，就执行下一步；否，则停止返回报错“当前职务***已经存档不能采用当前职务”； 如果BFF入参职务ID为空，就不执行下面所有查询，直接在DUBBO里新增编制。  */
        position = mPositionService.queryPositionDetail(queryPositionDetailReq);


//virtualUsage 1-3-13查询就职记录详情（查职务ID员工是否存在）  1708
        InductionRecord inductionRecord = null;
        QueryinductionRecordDetailReq queryinductionRecordDetailReq = new QueryinductionRecordDetailReq();
        queryinductionRecordDetailReq.setIsArchive("FALSE");//sourceId:35289_1_1708
        if (reqDto != null) {
            queryinductionRecordDetailReq.setOriginalRoleMemberId(reqDto.getOriginalRoleMemberId());//sourceId:23725_1_1708
            queryinductionRecordDetailReq.setPositionId(reqDto.getPositionId());//sourceId:35379_1_1708
            queryinductionRecordDetailReq.setPositionIdName(reqDto.getPositionIdName());//sourceId:51213_1_1708
            queryinductionRecordDetailReq.setInductionUnitTypeCode(reqDto.getInductionUnitTypeCode());//sourceId:25909_1_1708
            queryinductionRecordDetailReq.setEntityId(reqDto.getEntityId());//sourceId:25910_1_1708
        }

        /*1-3-13查询就职记录详情（查职务ID员工是否存在）[165] 根据DUBBO入参职务ID、原始角色成员关系ID，以及约定的存档类型“未存档”，返回就职记录为空，就可以执行下一步；  */
        inductionRecord = mInductionRecordService.queryinductionRecordDetail(queryinductionRecordDetailReq);

        // TODO: 2022/7/16 胡睿哲:手写代码,查询这个人是否有其他就职记录
        InductionRecord inductionRecordByHrz = null;
        QueryinductionRecordDetailReq queryinductionRecordDetailReq2 = new QueryinductionRecordDetailReq();
        queryinductionRecordDetailReq2.setIsArchive("FALSE");//sourceId:35289_1_1708
        queryinductionRecordDetailReq2.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());
        if (reqDto != null) {
            queryinductionRecordDetailReq2.setOriginalRoleMemberId(reqDto.getOriginalRoleMemberId());
        }

        /*1-3-13查询就职记录详情（查职务ID员工是否存在）[165] 根据DUBBO入参职务ID、原始角色成员关系ID，以及约定的存档类型“未存档”，返回就职记录为空，就可以执行下一步；  */
        inductionRecordByHrz = mInductionRecordService.queryinductionRecordDetail(queryinductionRecordDetailReq2);


//virtualUsage D2-3查询配置项匹配结果转答案(公共)  5659
        QueryItemMatchResultToAnswerDetailComRespDto queryItemMatchResultToAnswerDetailComRespDto = null;
        QueryItemMatchResultToAnswerDetailComReqDto queryItemMatchResultToAnswerDetailComReqDto = new QueryItemMatchResultToAnswerDetailComReqDto();
        queryItemMatchResultToAnswerDetailComReqDto.setConfItemCode("ORG_STRUCTURE_MODEL");//CUSTOM_CONVENTION//sourceId:105042_1_5659
        queryItemMatchResultToAnswerDetailComReqDto.setResultAspObjType("TENANT_SPACE");//sourceId:105043_1_5659
        queryItemMatchResultToAnswerDetailComReqDto.setResultAspObjId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:105044_1_5659

        /*D2-3查询配置项匹配结果转答案(公共)[3094]   */
        queryItemMatchResultToAnswerDetailComRespDto = confSchemeService.queryItemMatchResultToAnswerDetailCom(queryItemMatchResultToAnswerDetailComReqDto).getData();


        if ((position != null && inductionRecord == null && !(queryItemMatchResultToAnswerDetailComRespDto != null && queryItemMatchResultToAnswerDetailComRespDto.getOrgStructureModel() != null && queryItemMatchResultToAnswerDetailComRespDto.getOrgStructureModel().equals("NO_ORG")) && !(queryItemMatchResultToAnswerDetailComRespDto != null && queryItemMatchResultToAnswerDetailComRespDto.getOrgStructureModel() != null && queryItemMatchResultToAnswerDetailComRespDto.getOrgStructureModel().equals("PLAN_STAFFING")))) {
            //if((1-3-05查询职务详情.出参 值不等于空  and 1-3-13查询就职记录详情（查职务ID员工是否存在）.出参 值等于空  and D2-3查询配置项匹配结果转答案(公共).空间组织架构模式 不等于 无组织架构 and D2-3查询配置项匹配结果转答案(公共).空间组织架构模式 不等于 计划编制型))  1710

            String string = null;
            InductionRecord inductionRecord_2 = new InductionRecord();
            inductionRecord_2.setSubjectLifeCycle("EDITING");//sourceId:35372_1_1728
            inductionRecord_2.setIsEditing("TRUE");//sourceId:35373_1_1728
            inductionRecord_2.setIsUpdate("TRUE");//sourceId:35374_1_1728
            inductionRecord_2.setUpdateStatus("NEW");//sourceId:35375_1_1728
            if (reqDto != null) {
                inductionRecord_2.setInductionUnitTypeCode(reqDto.getInductionUnitTypeCode());//sourceId:22098_1_1728
                inductionRecord_2.setEntityId(reqDto.getEntityId());//sourceId:22099_1_1728
                inductionRecord_2.setOriginalRoleMemberId(reqDto.getOriginalRoleMemberId());//sourceId:22100_1_1728
                inductionRecord_2.setFirstLetter(reqDto.getFirstLetter());//sourceId:22948_1_1728
                inductionRecord_2.setUserId(reqDto.getUserId());//sourceId:22101_1_1728
                inductionRecord_2.setOrganizationId(reqDto.getOrganizationId());//sourceId:22102_1_1728
                inductionRecord_2.setOrganizationName(reqDto.getOrganizationName());//sourceId:22103_1_1728
                inductionRecord_2.setDeptShortName(reqDto.getDeptShortName());//sourceId:35361_1_1728
                // TODO: 2022/7/16 胡睿哲:手写代码,查询这个人是否有其他就职记录
                if (inductionRecordByHrz == null || inductionRecordByHrz.getInductionRecordId() == null) {
                    inductionRecord_2.setIsMainInduction("TRUE");//sourceId:22107_1_1728
                } else {
                    inductionRecord_2.setIsMainInduction("FALSE");//sourceId:22107_1_1728
                }
                inductionRecord_2.setIsCustomPosition(reqDto.getIsCustomPosition());//sourceId:22108_1_1728
                inductionRecord_2.setPositionType(reqDto.getPositionType());//sourceId:35370_1_1728
                inductionRecord_2.setPositionId(reqDto.getPositionId());//sourceId:22115_1_1728
                inductionRecord_2.setPositionIdNameId(reqDto.getPositionIdNameId());//sourceId:22111_1_1728
                inductionRecord_2.setPositionIdName(reqDto.getPositionIdName());//sourceId:22112_1_1728
                inductionRecord_2.setDirectorInductionRecordId(reqDto.getDirectorInductionRecordId());//sourceId:22129_1_1728
                inductionRecord_2.setInductionStartTime(reqDto.getInductionStartTime());//sourceId:35371_1_1728
//                inductionRecord_2.setBatchId(reqDto.getBatchId());//sourceId:22135_1_1728
                inductionRecord_2.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());
                inductionRecord_2.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());
                inductionRecord_2.setOrderNumber(reqDto.getOrderNumber());
            }

            /*1-3-13新增就职记录[162]   */
            string = mInductionRecordService.addInductionRecord(inductionRecord_2);

            string_1 = string;
//processBranchName:正常结束 ,processBranchId:1729

        } else if ((position != null && inductionRecord == null && queryItemMatchResultToAnswerDetailComRespDto != null && queryItemMatchResultToAnswerDetailComRespDto.getOrgStructureModel() != null && queryItemMatchResultToAnswerDetailComRespDto.getOrgStructureModel().equals("PLAN_STAFFING"))) {
            //elseif((1-3-05查询职务详情.出参 值不等于空  and 1-3-13查询就职记录详情（查职务ID员工是否存在）.出参 值等于空  and D2-3查询配置项匹配结果转答案(公共).空间组织架构模式 等于 计划编制型))  1730

            Staffing staffing = null;
            QueryStaffingDetailReq queryStaffingDetailReq = new QueryStaffingDetailReq();
            queryStaffingDetailReq.setInductionState("FALSE");//sourceId:22836_1_1731
            queryStaffingDetailReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:51308_1_1731
            if (reqDto != null) {
                queryStaffingDetailReq.setIsPartTimeStaffing(reqDto.getIsPartTimeStaffing());//sourceId:37815_1_1731
                queryStaffingDetailReq.setDeptId(reqDto.getEntityId());//sourceId:22838_1_1731
                queryStaffingDetailReq.setOrganizationId(reqDto.getOrganizationId());//sourceId:51318_1_1731
                queryStaffingDetailReq.setPositionId(reqDto.getPositionId());//sourceId:22839_1_1731
            }
  
    /*查询编制详情（查部门或组织下空编制）[191] 通过前端入参职务ID，查询是否有未锁定的空编制；有空编制的情况，出参编制ID，直接新增就职记录，跳过新增编制； 
无空编制 ，继续查询组织下是否有对应职务ID的空编制ID。  */
            staffing = mStaffingService.queryStaffingDetail(queryStaffingDetailReq);


            if ((staffing != null)) {
                //if(查询编制详情（查部门或组织下空编制）.出参 不等于空 )  1732

                String string_2 = null;
                if (staffing != null) {
                    InductionRecord inductionRecord_3 = new InductionRecord();
                    inductionRecord_3.setSubjectLifeCycle("EDITING");//sourceId:35372_1_1733
                    inductionRecord_3.setIsEditing("TRUE");//sourceId:35373_1_1733
                    inductionRecord_3.setIsUpdate("TRUE");//sourceId:35374_1_1733
                    inductionRecord_3.setUpdateStatus("NEW");//sourceId:35375_1_1733
                    if (reqDto != null) {
                        inductionRecord_3.setInductionUnitTypeCode(reqDto.getInductionUnitTypeCode());//sourceId:22098_1_1733
                        inductionRecord_3.setEntityId(reqDto.getEntityId());//sourceId:22099_1_1733
                        inductionRecord_3.setOriginalRoleMemberId(reqDto.getOriginalRoleMemberId());//sourceId:22100_1_1733
                        inductionRecord_3.setFirstLetter(reqDto.getFirstLetter());//sourceId:22948_1_1733
                        inductionRecord_3.setUserId(reqDto.getUserId());//sourceId:22101_1_1733
                        inductionRecord_3.setOrganizationId(reqDto.getOrganizationId());//sourceId:22102_1_1733
                        inductionRecord_3.setOrganizationName(reqDto.getOrganizationName());//sourceId:22103_1_1733
                        inductionRecord_3.setDeptShortName(reqDto.getDeptShortName());//sourceId:35361_1_1733
                        // TODO: 2022/7/16 胡睿哲:手写代码,查询这个人是否有其他就职记录
                        if (inductionRecordByHrz == null || inductionRecordByHrz.getInductionRecordId() == null) {
                            inductionRecord_3.setIsMainInduction("TRUE");//sourceId:22107_1_1728
                        } else {
                            inductionRecord_3.setIsMainInduction("FALSE");//sourceId:22107_1_1728
                        }
                        inductionRecord_3.setIsCustomPosition(reqDto.getIsCustomPosition());//sourceId:22108_1_1733
                        inductionRecord_3.setPositionType(reqDto.getPositionType());//sourceId:35370_1_1733
                        inductionRecord_3.setPositionId(reqDto.getPositionId());//sourceId:22115_1_1733
                        inductionRecord_3.setPositionIdNameId(reqDto.getPositionIdNameId());//sourceId:22111_1_1733
                        inductionRecord_3.setPositionIdName(reqDto.getPositionIdName());//sourceId:22112_1_1733
                        inductionRecord_3.setDirectorInductionRecordId(reqDto.getDirectorInductionRecordId());//sourceId:22129_1_1733
                        inductionRecord_3.setInductionStartTime(reqDto.getInductionStartTime());//sourceId:35371_1_1733
//                        inductionRecord_3.setBatchId(reqDto.getBatchId());//sourceId:22135_1_1733
                        inductionRecord_3.setOrderNumber(reqDto.getOrderNumber());
                    }
                    if (staffing != null) {
                        inductionRecord_3.setStaffingId(staffing.getStaffingId());//sourceId:51347_1_1733
                    }

                    inductionRecord_3.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());
                    inductionRecord_3.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());

                    /*1-3-13新增就职记录[162]   */
                    string_2 = mInductionRecordService.addInductionRecord(inductionRecord_3);

                    string_1 = string_2;
                }
                boolean bOOLEAN;
                if (staffing != null) {
                    Staffing staffing_2 = new Staffing();
                    staffing_2.setInductionState("TRUE");//sourceId:37534_1_1734
                    staffing_2.setTempLock("TRUE");//sourceId:37563_1_1734
                    if (staffing != null) {
                        staffing_2.setStaffingId(staffing.getStaffingId());//sourceId:37533_1_1734
                    }
                    if (reqDto != null) {
                        staffing_2.setIsUsedbyPartTime(reqDto.getIsPartTimeStaffing());//sourceId:51591_1_1734
                    }

                    /*1-3-15修改编制（锁定编制等）[186]   */
                    bOOLEAN = mStaffingService.updateStaffing(staffing_2);


                }
//processBranchName:正常结束 ,processBranchId:1735

            } else {
                //else  1736

//异常结束 1737
                throw new BizException("10300014", "对不起，没有空缺岗位，不可加入成员～！", false);
            }
        } else if ((position == null || inductionRecord != null)) {
            //elseif((1-3-05查询职务详情.出参 等于空  or 1-3-13查询就职记录详情（查职务ID员工是否存在）.出参 不等于空 ))  1755

//异常结束 1756
            throw new BizException("10300027", "对不起，当前岗位员工已经在部门下或选择的职务无效，不可加入～！	", false);
        }
        AddInductionRecordRespDto retData = new AddInductionRecordRespDto();
        if (string_1 != null) {
            retData.setInductionRecordId(string_1);//sourceId:29736_1
        }


        return retData;
    }

    /**
     * D1-1删除对象属性[351]
     */
    @Trace(operationName = "D1-1删除对象属性")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public DeleteObjAttributeRespDto deleteObjAttribute(DeleteObjAttributeReqDto reqDto) {


        //步骤0: 1-1-04删除对象属性 - deleteObjAttribute
        boolean bOOLEAN;
        String string = new String();
        if (reqDto != null) {
            string = reqDto.getObjectPropertyId();
            ;//sourceId:6332_1
        }

        /*1-1-04删除对象属性[15]   */
        bOOLEAN = mMetadataObjectPropertyService.deleteObjAttribute(string);


        DeleteObjAttributeRespDto retData = new DeleteObjAttributeRespDto();


        return retData;
    }

    /**
     * D1-1删除标签[620]
     * gen by moon at 11/21/2022, 11:53:36 PM
     */
    @Trace(operationName = "D1-1删除标签")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public DeleteTagRespDto deleteTag(DeleteTagReqDto reqDto) {


        //步骤0: 1-1-16查询标签详情 - queryTagDetail
        com.wicket.okrframework.dal.po.mbg.Tag tag = null;
        QueryTagDetailReq queryTagDetailReq = new QueryTagDetailReq();
        queryTagDetailReq.setSubjectLifeCycle("EDITING");//sourceId:417773_1
        if (reqDto != null) {
            queryTagDetailReq.setTagId(reqDto.getTagId());//SimpleFieldAssign//sourceId:417765_1
        }

        /*1-1-16查询标签详情[203]   */
        Assert.isNull(queryTagDetailReq.getTagId(), "D1-1删除标签-1-1-16查询标签详情-标签ID不能为空", false);
        Assert.isNull(queryTagDetailReq.getSubjectLifeCycle(), "D1-1删除标签-1-1-16查询标签详情-主体生命周期不能为空", false);
        tag = mTagService.queryTagDetail(queryTagDetailReq);
        Assert.isTrue(tag == null || tag.getTagId() == null, "找不到数据，系统异常", false);


//步骤1: 1-1-16删除标签 - deleteTag
        boolean bOOLEAN;
        if (tag != null) {
            String string = new String();
            if (tag != null) {
                string = tag.getTagId();
                ;//SimpleFieldAssign//sourceId:417764_1
            }

            /*1-1-16删除标签[111]   */
            Assert.isNull(string, "D1-1删除标签-1-1-16删除标签-标签ID不能为空", false);
            bOOLEAN = mTagService.deleteTag(string);


        }

        DeleteTagRespDto retData = new DeleteTagRespDto();


        return retData;
    }

    /**
     * D1-1批量查询对象属性列表[991]
     * gen by moon at 5/24/2023, 3:36:49 AM
     */
    @Trace(operationName = "D1-1批量查询对象属性列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public BatchQueryObjAttributeListRespDto batchQueryObjAttributeList(BatchQueryObjAttributeListReqDto reqDto) {


        List<MetadataObjectProperty> listMetadataObjectProperty_1 = new ArrayList<>();
//步骤0: 1-1-04批量查询对象属性列表 - batchQueryObjAttributeList
        List<MetadataObjectProperty> listMetadataObjectProperty = new ArrayList<>();
        BatchQueryObjAttributeListReq batchQueryObjAttributeListReq = new BatchQueryObjAttributeListReq();
        if (reqDto != null) {
            batchQueryObjAttributeListReq.setBusinessObjectId(reqDto.getBusinessObjectId());//SimpleFieldAssign//sourceId:21168_1
            batchQueryObjAttributeListReq.setBusinessObjectCode(reqDto.getBusinessObjectCode());//SimpleFieldAssign//sourceId:21182_1
            batchQueryObjAttributeListReq.setObjAttributeIdList(reqDto.getObjAttributeIdList());//list-field-assign//sourceId:21063_1
        }

        /*1-1-04批量查询对象属性列表[990]   */

        listMetadataObjectProperty = mMetadataObjectPropertyService.batchQueryObjAttributeList(batchQueryObjAttributeListReq)/*vcase invoke 本地 method 方法调用;*/;


        listMetadataObjectProperty_1 = listMetadataObjectProperty;

        BatchQueryObjAttributeListRespDto retData = new BatchQueryObjAttributeListRespDto();
        retData.setBaseMetadataObjectPropertyList(listMetadataObjectProperty_1.stream().map(item -> BeanUtil.toBean(item, BaseMetadataObjectPropertyDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:21089_1


        return retData;
    }

    /**
     * D1查询对象属性列表(公共)[8748]
     * gen by moon at 3/23/2024, 7:32:20 PM
     */
    @Trace(operationName = "D1查询对象属性列表(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryObjAttributeListComRespDto queryObjAttributeListCom(QueryObjAttributeListComReqDto reqDto) {


        List<MetadataObjectProperty> listMetadataObjectProperty_1 = new ArrayList<>();
//步骤0: 1-1-04查询对象属性列表 - queryObjAttributeList
        List<MetadataObjectProperty> listMetadataObjectProperty = new ArrayList<>();
        QueryObjAttributeListReq queryObjAttributeListReq = new QueryObjAttributeListReq();
        if (reqDto != null) {
            queryObjAttributeListReq.setBusinessObjectId(reqDto.getBusinessObjectId());//SimpleFieldAssign//sourceId:1637781_1
            queryObjAttributeListReq.setBusinessObjectCode(reqDto.getBusinessObjectCode());//SimpleFieldAssign//sourceId:1637794_1
            queryObjAttributeListReq.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:1637789_1
            queryObjAttributeListReq.setSpaceId(reqDto.getSpaceId());//SimpleFieldAssign//sourceId:1637790_1
        }

        /*1-1-04查询对象属性列表[220]   */
        Assert.isNull(queryObjAttributeListReq.getSubjectLifeCycle(), "D1查询对象属性列表(公共)-1-1-04查询对象属性列表-主体生命周期不能为空", false);
        Assert.isNull(queryObjAttributeListReq.getSpaceId(), "D1查询对象属性列表(公共)-1-1-04查询对象属性列表-创建于空间ID不能为空", false);
        listMetadataObjectProperty = mMetadataObjectPropertyService.queryObjAttributeList(queryObjAttributeListReq)/*vcase invoke 本地 method 方法调用;*/;


        listMetadataObjectProperty_1 = listMetadataObjectProperty;

        QueryObjAttributeListComRespDto retData = new QueryObjAttributeListComRespDto();
        retData.setBaseMetadataObjectPropertyList(listMetadataObjectProperty_1.stream().map(item -> BeanUtil.toBean(item, BaseMetadataObjectPropertyDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:1637797_1


        return retData;
    }
    //
}
